From: sibir on
I have some binary files with mixed ByteOrdering. The actual data is
little endian but the metadata in the header is big endian. Is there a
clever way to swap the bytes in a short integer?
My first shot looks rather ugly:

swapBytes[b_] := BitOr[BitShiftLeft[BitAnd[255, b] 1, 8],
BitShiftRight[b, 8]]

Cheers