I want to write a program which reverses the bits of an integer.
Ex 11000101 to 10100011
I know how to solve this using a loop, but I came across solutions that do it us
If your integers are in range 0..255, it is acceptable to tabulate all 256 reversed values. (You can tabulate just nibbles but that would be a poor man's solution.)
For larger values, swap and simultaneously reverse the bytes using that table. You can do the swap by a combination of masks and shifts, or by mapping four bytes onto the int.