byteswap

Swaps bytes in a 2 byte ushort.

nothrow @safe @nogc pragma(inline, false) pure
ushort
byteswap
(
ushort x
)

Parameters

x ushort

value

Return Value

Type: ushort

x with bytes swapped

Examples

assert(byteswap(cast(ushort)0xF234) == 0x34F2);
static ushort xx = 0xF234;
assert(byteswap(xx) == 0x34F2);

Meta