将8位二进制倒序(c语言实现)
unsigned char Reverse(unsigned char data)
{
unsigned char tmp = 0, i = 0, rtn_data = 0, a[i] = {0};
tmp = data & 0xff;
for(i = 0; i < 8; i++)
{
a[i] = tmp % 2;
tmp = tmp / 2;
rtn_data += a[i] * pow(2, 7-i);
}
return rtn_data;
}
将8位二进制倒序
最新推荐文章于 2023-02-22 19:07:50 发布