bswap

Swaps bytes in an 8 byte ulong end-to-end, i.e. byte 0 becomes byte 7, byte 1 becomes byte 6, etc. This is meant to be recognized by the compiler as an intrinsic.

  1. uint bswap(uint v)
  2. ulong bswap(ulong v)
    nothrow @safe @nogc pure
    ulong
    bswap
    (
    ulong v
    )

Examples

assert(bswap(0x01020304_05060708uL) == 0x08070605_04030201uL);
static ulong xx = 0x10203040_50607080uL;
assert(bswap(xx) == 0x80706050_40302010uL);

Meta