8位的按位转置 [英] Bitwise transpose of 8 bytes

查看:194
本文介绍了8位的按位转置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在C中寻找一个有效的算法来逐位转置8个字节的数据。我的意思是,如果我有这样的8个字节:$ / $ $ $ $ $ $ $ $ $
00000000
11000000
00000000
11111111
01010101

我想得到以下8个字节:

  00001010 
00001011
01000010
11000011
11000010
10000011
00000010
00100011

因为我想在嵌入式平台上使用它,它应该尽可能快: - )



所有的想法都非常感谢!

解决方案

请参阅 Hacker's Delight ,第7-3章。


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!

解决方案

See Hacker's Delight, Chapter 7-3.

这篇关于8位的按位转置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆