开发者

Bitwise transpose of 8 bytes

开发者 https://www.devze.com 2022-12-19 17:38 出处:网络
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 th开发者_如何学JAVAis:

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 th开发者_如何学JAVAis:

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!


See Hacker's Delight, Chapter 7-3.

0

精彩评论

暂无评论...
验证码 换一张
取 消