Provide a 2^N-bit integer type. Guaranteed to never allocate and expected binary layout Recursive implementation with very slow division.
Supports all operations that builtin integers support.
Wide signed integer.
bits | number of bits, must be a power of 2. |
Wide unsigned integer.
bits | number of bits, must be a power of 2. |
Recursive 2^n integer implementation.
Construct from a value.
Construct from compile-time digit string.
Both decimal and hex digit strings are supported.
auto x = int128.literal!"20_000_000_000_000_000_001"; assert((x >>> 1) == 0x8AC7_2304_89E8_0000); auto y = int126.literal!"0x1_158E_4609_13D0_0001"; assert(y == x);
Assign with a smaller unsigned type.
Assign with a smaller signed type (sign is extended).
Assign with a wide integer of the same size (sign is lost).
Assign with a smaller wide integer (sign is extended accordingly).
Cast to a smaller integer type (truncation).
Cast to bool.
Cast to wide integer of any size.
Converts to a string. Supports format specifiers %d, %s (both decimal)
and %x (hex).