小端模式:多字节时低字节在前
eg:char* p = {0x1E,0x00}代表为0x001E(十进制的30)
->int tem16 = 0;
tmp16 = ((unsigned short)(p[1] << 8)) | (unsigned char)p[0];
-->tem16 == 30
时间: 2024-11-04 22:49:43
小端模式:多字节时低字节在前
eg:char* p = {0x1E,0x00}代表为0x001E(十进制的30)
->int tem16 = 0;
tmp16 = ((unsigned short)(p[1] << 8)) | (unsigned char)p[0];
-->tem16 == 30