Bitreflection
Bitreflection is the operation of reversing the order of bits in a fixed-width binary representation. For an n-bit word, it maps the bit sequence b1 b2 ... bn to bn ... b2 b1.
Notationally, if x is an n-bit integer with bits b0 through b(n-1), the bitreflection br_n(x) is defined
Example: for n = 4, x = 11, which is binary 1011, yields br_4(11) = 13, which is binary
Applications of bitreflection commonly arise in digital signal processing and algorithms that operate on binary data
Implementation notes: a straightforward method computes br_n(x) by iterating over each bit and setting the mirrored