Re: [swift-users] How to dispatch on the size of Int?

2016-11-23 Thread Hooman Mehr via swift-users
I agree, there should be a platform condition that just indicates native word size, such as arch(32bit) and arch(64bit). > On Nov 23, 2016, at 2:18 PM, Martin R wrote: > > Yes, I had forgotten about that, thank you! That would satisfy all criteria. > And with > >

Re: [swift-users] How to dispatch on the size of Int?

2016-11-23 Thread Martin R via swift-users
Yes, I had forgotten about that, thank you! That would satisfy all criteria. And with func foo(value: Int) { #if arch(i386) || arch(arm) foo_impl(value: Int32(value)) #elseif arch(x86_64) || arch(arm64) foo_impl(value: Int64(value)) #endif } it should be

[swift-users] How to dispatch on the size of Int?

2016-11-23 Thread Martin R via swift-users
I wonder what the best way would be to call a specialized function dependent on the size of `Int`. Let's say that I have two implementations func foo_impl(value: Int32) { /* ... */ } func foo_impl(value: Int64) { /* ... */ } and I want func foo(value: Int) to call the "right one"