可以将两个字节的十六进制数合并成一个 uint16_t 类型的变量,如下所示:

uint8_t highByte = 0x11; uint8_t lowByte = 0x2e; uint16_t mapid = (highByte << 8) | lowByte;

这样就可以将 0x11 和 0x2e 合并成 1687228718。

nt main uint16_t mapid = 1687228718; uint8_t highByte = mapid 8 & 0xFF; uint8_t lowByte = mapid & 0xFF; stdcout 0x stdhex unsignedhighByte 0x unsignedlowByte stdendl; return 0;

原文地址: http://www.cveoy.top/t/topic/hmpm 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录