Int128.opCast

Support casting to an integral type

  1. bool opCast()
  2. T opCast()
    struct Int128
    const
    T
    opCast
    (
    T : long
    )
    ()
    if (
    is(byte : T)
    )
  3. T opCast()

Return Value

Type: T

low bits of value reinterpreted as T

Examples

const Int128 a = Int128(0xffff_ffff_ffff_ffffL, 0x0123_4567_89ab_cdefL);
assert(cast(long) a == 0x0123_4567_89ab_cdefL);
assert(cast(int)  a ==           0x89ab_cdef);
assert(cast(byte) a == cast(byte) 0xef);

Meta