5 ms·
Swap reverses all bits in chunks of the granularity size. So given bits = ABCDEFGHIJKLMNOP, you get: swapped(8, bits) -> IJKLMNOPABCDEFGH swapped(4, bi
by kstenerud 4y ago
Swap reverses all bits in chunks of the granularity size. So given bits = ABCDEFGHIJKLMNOP, you get:
swapped(8, bits) -> IJKLMNOPABCDEFGH
swapped(4, bits) -> MNOPIJKLEFGHABCD
swapped(2, bits) -> OPMNKLIJGHEFCDAB
swapped(1, bits) -> PONMLKJIHGFEDCBA
So the full bit reversal when granularity = 1 is emergent phenomena rather than an exception.
- JaumeGreen 4y agoOk, that is more understandable. If there were some more examples in the page then this emergent behaviour could be seen faster. Nothing to add then
- kstenerud 4y agoCool! Even this feedback is important. This document needs to be accessible and easy to grasp, otherwise it has a UX problem.