swapEndian

Swaps the endianness of the given integral value or character.

@safe pure nothrow @nogc
T
swapEndian
(
T
)
(
const T val
)

Examples

assert(42.swapEndian == 704643072);
assert(42.swapEndian.swapEndian == 42); // reflexive
assert(1.swapEndian == 16777216);

assert(true.swapEndian == true);
assert(byte(10).swapEndian == 10);
assert(char(10).swapEndian == 10);

assert(ushort(10).swapEndian == 2560);
assert(long(10).swapEndian == 720575940379279360);
assert(ulong(10).swapEndian == 720575940379279360);

Meta