When you say “LLVM has good support for arbitrary-sized integers”, what does that mean? Also, I wouldn’t say that "Swift uses LLVM"… The only (complete) Swift compiler that I’m aware of is built on the LLVM infrastructure, and Xcode does use many of LLVM’s (and LLDB's) features to do its IDE voodoo, but the language itself doesn’t require any particular compiler to be used. In light of that, I’m not sure it’s wise to be tying Swift’s standard library so closely to something that’s strictly part of LLVM. OTOH, I’m also not sure it’d be any harder to add a few bigint types to a compiler than to a library, so maybe that doesn’t really matter in this case.
What about creating UInt/Int128, UInt/Int256, etc up to the largest size which can fit in the target’s SIMD unit? That should allow for Int128 to be pseudo-natively handled on any CPU Swift is officially targeting, but wider than that and I’m not sure (also it obviously would use the SIMD unit, which may not be what you want)
How would this affect the `IntMax` typealias and its associated functions?
- Dave Sweeris
On Jun 15, 2016, at 10:58 AM, Félix Cloutier via swift-evolution <email@example.com> wrote:
I know that one, but I merely need fixed-size big integers. Backing all of my integers with an array seems overly expensive.
Le 14 juin 2016 à 23:25:16, T.J. Usiyan <firstname.lastname@example.org <mailto:email@example.com>> a écrit :
There is also a fairly robust implementation of arbitrary size integers here https://github.com/lorentey/BigInt/tree/master/Sources
On Tue, Jun 14, 2016 at 10:02 PM, Charlie Monroe via swift-evolution <firstname.lastname@example.org <mailto:email@example.com>> wrote:
128-bit Ints have been discussed here a few weeks ago:
On Jun 15, 2016, at 5:50 AM, Félix Cloutier via swift-evolution <firstname.lastname@example.org <mailto:email@example.com>> 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.