问题
I am looking for an efficient algorithm in C to bitwise-transpose 8 bytes of data. What I mean with this is that if I have 8 bytes like this:
00011100
00111000
00000001
00000000
11000000
00000000
11111111
01010101
I want to get the following 8 bytes:
00001010
00001011
01000010
11000011
11000010
10000011
00000010
00100011
And since I want to use this on an embedded platform, it should be as fast as possible :-)
All ideas are much appreciated!
回答1:
See Hacker's Delight, Chapter 7-3.
来源:https://stackoverflow.com/questions/2243985/bitwise-transpose-of-8-bytes