移位操作
程序员文章站
2022-04-14 18:39:43
1. u16 g_summ = 0; u8 buf[2] = {0x10, 0x05}; g_summ = (buf[1] << 8) | buf[0]; // g_summ = 0x0510 2. u16 g_summ = 0x0510; buf[0] = (u8 )g_summ; // buf[ ......
1.
u16 g_summ = 0;
u8 buf[2] = {0x10, 0x05};
g_summ = (buf[1] << 8) | buf[0]; // g_summ = 0x0510
2.
u16 g_summ = 0x0510;
buf[0] = (u8 )g_summ; // buf[0] = 0x10
buf[1] = (u8 )(g_summ >> 8); // buf[1] = 0x05
上一篇: 标签--格式化标签
下一篇: 使用php过滤emoji表情