the integral value
Tests the order!(T)(T, Order)
To Big Endian testing
version(LittleEndian) { ushort i = 1; writeln("Pre-order: ", i); ushort ordered = order(i, Order.BE); writeln("Post-order: ", ordered); assert(ordered == 256); } else version(BigEndian) { ushort i = 1; writeln("Pre-order: ", i); ushort ordered = order(i, Order.BE); writeln("Post-order: ", ordered); assert(ordered == i); }
Tests the order!(T)(T, Order)
To Little Endian testing
version(LittleEndian) { ushort i = 1; writeln("Pre-order: ", i); ushort ordered = order(i, Order.LE); writeln("Post-order: ", ordered); assert(ordered == i); } else version(BigEndian) { ushort i = 1; writeln("Pre-order: ", i); ushort ordered = order(i, Order.LE); writeln("Post-order: ", ordered); assert(ordered == 256); }
Swaps the bytes to the given ordering but does a no-op if the ordering requested is the same as that of the system's