我需要在左移中将LSB 0转换为1:
x=5; int num = 0x02;//0b00000010 shiftVal = num << x;// 0b01000000
shiftVal 应转换为 0b01011111
只需将它们设置为 1
hiftVal = (num << x) | ((1 << x) - 1);