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_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, 0, 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;

}

阅读更多
版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/bigtree_mfc/article/details/80332863
文章标签: WIN32
个人分类: WIN32
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

不良信息举报

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

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭