[swift-evolution] [Idea] A 128-bit unsigned integer value type
karoly at lorentey.hu
Sat May 21 09:52:27 CDT 2016
On 2016-05-17 14:30:36 +0000, Muse M via swift-evolution said:
> Most programming languages does have 128-bit of type except Swift.
I don't think there is huge demand for a full-blown Int128 type in the
standard library, but it would be nice to have double-width
multiplication & division methods in Swift's existing integer types. I
assume LLVM has intrinsics for this that compile down to single
instructions on x86_64.
This would speed up some 64-bit fixed-point operations with 128-bit
temporaries (such as Mach timestamp scaling arithmetic) and allow pure
Swift arbitrary-precision integer packages to provide faster operations.
I currently need to emulate full-width multiplication/division with
code such as this:
A 128/64=64 full-width division done this way requires 2 single-width
divisions and 6 multiplications. I'd love to replace this with a single
full-width x86 DIV instruction.
More information about the swift-evolution