32位数据转8位数据和8位数据转32位数据

1。32位数据转换为8位数据 UINT32 m_num32[512];//32里面有参数UINT8 m_num8[2048];UINT8 m_temp;memset(m_num8, 0, 2048);for(int i = 0; i 512; i++){m_temp = m_num32[i] 24;m_num8[i] = m_temp;m_temp = m

1。32位数据转换为8位数据

UINT32 m_num32[512];//32里面有参数

UINT8 m_num8[2048];

UINT8 m_temp;

memset(m_num8,2048);

for(int i = 0; i < 512; i++)

{

m_temp = m_num32[i] >> 24;

m_num8[i] = m_temp;

m_temp = m_num32[i] >> 16;

m_num8[i + 512] = m_temp;

m_temp = m_num32[i] >> 8;

m_num8[i + 1024] = m_temp;

m_temp = m_num32[i];

m_num8[i + 1536] = m_temp;

}

2.8位数据转换位32位数据

UINT32 m_num32[512];

UINT8 m_num8[2048];//8里面有数据

UINT8 m_temp;

memset(m_num32,512);

for(int i = 0; i < 512; i++)

{

m_temp = m_num8[i];

m_num32[i] |= m_temp << 24;

m_temp = m_num8[i + 512];

m_num32[i] |= m_temp << 16;

m_temp = m_num8[i + 1024];

m_num32[i] |= m_temp << 8;

m_temp = m_num8[i + 1536];

m_num32[i] |= m_temp;

}

作者: dawei

【声明】:永州站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。

为您推荐

联系我们

联系我们

0577-28828765

在线咨询: QQ交谈

邮箱: xwei067@foxmail.com

工作时间:周一至周五,9:00-17:30,节假日休息

返回顶部