在c中检索有符号长long的最重要的32位

时间:2015-09-09 20:31:17

标签: c bits

由于某种原因,当使用指针

引用位时,高32位丢失

机器是小端的。

s64 num = 0x12345678ABCDEF99;
printf("%x%x", *(int* )((&num) + sizeof(int) ) ,*(int* )(&num));
//i used *(int* )(&num)to show that it works only with the first 32 bits

输出:0abcdef99

0 个答案:

没有答案