[swift-evolution] [Review] SE-0104: Protocol-oriented integers

Stephen Canon scanon at apple.com
Fri Jun 24 14:01:40 CDT 2016


> On Jun 24, 2016, at 2:52 PM, Haravikk via swift-evolution <swift-evolution at swift.org> wrote:
> 
> 
>> On 24 Jun 2016, at 18:17, Károly Lőrentey via swift-evolution <swift-evolution at swift.org> wrote:
>> I’m especially stoked about `FixedWidthInteger.doubleWidthMultiply`, which will likely lead to a measurable speedup. Why is there no `doubleWidthQuotientAndRemainder` or `doubleWidthDivide`, though?
> 
> Double-width isn't needed for these as it's impossible for an integer to become larger when dividing (the smallest value you can divide by and get a result is 2, which will halve the value), and the remainder can't be larger than the original value.

A double-width divide takes a double-width *numerator*, and is a useful building block for some approaches to bignum divides.

– Steve


More information about the swift-evolution mailing list