[swift-evolution] [swift-evolution-announce] [Review] SE-0104: Protocol-oriented integers

David Sweeris 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?
> Félix

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...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160623/8845a910/attachment.html>

More information about the swift-evolution mailing list