[swift-evolution] Shift operator: the type of the second operand
dabrahams at apple.com
Sat Dec 19 22:04:17 CST 2015
> On Dec 19, 2015, at 8:02 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org> wrote:
>> On Dec 19, 2015, at 7:43 PM, Jordan Rose via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> +1 to dropping the existing signatures and providing a consistent right-hand side.
>> I'm a little concerned about not allowing Int as the shift type. Even though we disallow negative shifts, we generally encourage using 'Int' as the "vocabulary" type for integers, which means any shift by a non-constant amount might require a conversion. I do see that BigInts may be shifted by more than 2^64, however, so hardcoding Int wouldn't be right either.
> Unless it is somehow sparsely encoded, a bigint with more than 2^64 bits couldn’t be held in memory.
I don't believe bit shifting should be supported for BigInt anyway. The lossy semantics of bit shifting is pretty closely tied to fixed-width integers.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution