[swift-evolution] Arbitrary-sized integers

Dave Abrahams dabrahams at apple.com
Thu Jun 16 09:30:55 CDT 2016


on Tue Jun 14 2016, Félix Cloutier <swift-evolution at swift.org> wrote:

> I'm writing a program that would need Int128s. Since Swift uses LLVM
> and LLVM has good support for arbitrary-sized integers (well, up to
> 2^24 bits anyways), I was wondering if there was any interest in
> having arbitrary-sized integers in Swift.

There's an implementation of DoubleWidth integers in
https://github.com/apple/swift/blob/master/test/Prototypes/Integers.swift.gyb#L926.
We are planning to bring forward a proposal for integer protocols RSN™
that would allow you to write Int128 as

    typealias Int128 = DoubleWidth<Int64>

HTH,

-- 
-Dave



More information about the swift-evolution mailing list