0
#include <stdint.h>
uint8_t bitsLow;
uint16_t bitsHigh;
uint32_t statusBits;
...
bitsHigh = (statusBits >> 8) & 0xffff;
bitsLow = statusBits & 0xff;

从以下整数提升规则的角度来看,这是否有意义:

bitsHigh = (statusBits >> 8) & 0xffffU;
bitsLow = statusBits & 0xffU;

(据我了解 0xff 或 0xffff 默认具有整数类型)

4

0 回答 0