[swift-evolution] [swift-evolution-announce] [Review] SE-0104: Protocol-oriented integers
davesweeris at mac.com
Thu Jun 23 23:39:59 CDT 2016
> On Jun 23, 2016, at 22:47, Félix Cloutier via swift-evolution <swift-evolution at swift.org> wrote:
> Thanks for answering my questions earlier. I like a lot of the changes.
> Speaking of heterogeneous comparisons again, though, how are comparisons of negative signed integers with unsigned integers handled?
I can't speak for anyone else, but I'd check the sign bit, return the correct answer if it's negative, and if not do an unsafeBitCast to the same-width unsigned type and use that to return the results of the homogeneous comparison.
There's probably a quicker way using some arcane bit-fiddling wizardry, but I don't know it off the top of my head.
- Dave Sweeris
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the swift-evolution