例如:我要将变量tm移位处理?
unsigned long long tm=0x12345678A1B2C3D4
unsigned int xp,tp;
//想得到xp的值为0x345678A1?
xp = tm>>24; //为什么的到的数据不是想要的数据
//tp==0x12
tp = tm>>56; //
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
例如:我要将变量tm移位处理?
unsigned long long tm=0x12345678A1B2C3D4
unsigned int xp,tp;
//想得到xp的值为0x345678A1?
xp = tm>>24; //为什么的到的数据不是想要的数据
//tp==0x12
tp = tm>>56; //
比如变量时是: unsigned long long tm=0x12345678A1B2C3D4;
我最终目的要把tm最高字节(0x12)放在字节变量unsigned char 类型的 Index中;
把tm剩余变量值(0x345678A1)放在unsigned int类型的fradex中;
为此,我将你说的xp,tp改成unsigned long long xp,tp;任何混乱。
xp = tm>>24; //单步调试正确
fradex = xp; //单步调试正确
xy = tm>>56; //单步调试,Index变为0; fradex变为0x34;反而将上面正确的fradex变错误了!
Index = yp; //index仍为0,fradex仍错误!