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

Stephen Canon scanon at apple.com
Thu Jun 23 11:26:57 CDT 2016


On Jun 23, 2016, at 2:23 AM, Félix Cloutier via swift-evolution <swift-evolution at swift.org> wrote:

> Do we lose the ability to create a signed integer from an unsigned bit pattern?

The existing `init(bitPattern x: UIntN)` are still present on the concrete types in the prototype.  There’s a new init at the Protocol level that handles the fully generic case:

/// Creates in instance of `Self` from `source` by sign-extending it
/// indefinitely and then truncating to fit `Self`.
init<T : Integer>(extendingOrTruncating source: T)

– Steve
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160623/72c127c1/attachment.html>


More information about the swift-evolution mailing list