September 2012
Intermediate to advanced
512 pages
12h 41m
English
By “reversing bits” we mean to reflect the contents of a register about the middle so that, for example,
rev(0x01234567) = 0xE6A2C480.
By “reversing bytes” we mean a similar reflection of the four bytes of a register. Byte reversal is a necessary operation to convert data between the “little-endian” format used by DEC and Intel, and the “big-endian” format used by most other manufacturers.
Bit reversal can be done quite efficiently by interchanging adjacent single bits, then interchanging adjacent 2-bit fields, and so on, as shown below [Aus1]. These five assignment statements can be executed in any order. This is the same algorithm as the first population count algorithm of ...