Initializer

init(bitPattern:)

Creates a new instance with the same memory representation as the given value.

Declaration

init(bitPattern x: UInt)

Parameters

x

A value to use as the source of the new instance’s binary representation.

Discussion

This initializer does not perform any range or overflow checking. The resulting instance may not have the same numeric value as bitPattern—it is only guaranteed to use the same pattern of bits in its binary representation.

See Also

Converting Integers

init<T>(T)

Creates a new instance from the given integer.

init?<T>(exactly: T)

Creates a new instance from the given integer, if it can be represented exactly.

init<Other>(clamping: Other)

Creates a new instance with the representable value that’s closest to the given integer.

init<T>(truncatingIfNeeded: T)

Creates a new instance from the bit pattern of the given instance by truncating or sign-extending if needed to fit this type.