Type Property

bitWidth

The number of bits used for the underlying binary representation of values of this type.

Required. Default implementation provided.

Declaration

static var bitWidth: Int { get }

Discussion

An unsigned, fixed-width integer type can represent values from 0 through (2 ** bitWidth) - 1, where ** is exponentiation. A signed, fixed-width integer type can represent values from -(2 ** (bitWidth - 1)) through (2 ** (bitWidth - 1)) - 1. For example, the Int8 type has a bitWidth value of 8 and can store any integer in the range -128...127.

Default Implementations

FixedWidthInteger Implementations

var bitWidth: Int

The number of bits in the binary representation of this value.