Bit reversal of an integer, ignoring integer size and endianness

后端 未结 12 2305
既然无缘
既然无缘 2021-01-03 00:18

Given an integer typedef:

typedef unsigned int TYPE;

or

typedef unsigned long TYPE;

I have the following

12条回答
  •  旧时难觅i
    2021-01-03 00:37

    We can store the results of reversing all possible 1 byte sequences in an array (256 distinct entries), then use a combination of lookups into this table and some oring logic to get the reverse of integer.

提交回复
热议问题