bswap

Swaps bytes in a 4 byte uint end-to-end, i.e. byte 0 becomes byte 3, byte 1 becomes byte 2, byte 2 becomes byte 1, byte 3 becomes byte 0.

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

Examples

assert(bswap(0x01020304u) == 0x04030201u);
static uint xx = 0x10203040u;
assert(bswap(xx) == 0x40302010u);

Meta