[swift-evolution] Shift operator: the type of the second operand

Chris Lattner clattner at apple.com
Sat Dec 19 22:02:07 CST 2015

> On Dec 19, 2015, at 7:43 PM, Jordan Rose via swift-evolution <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.  


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20151219/89c93579/attachment.html>

More information about the swift-evolution mailing list