Home > Back-end >  64 FF all move around 64 or full FF is why?
64 FF all move around 64 or full FF is why?

Time:05-20

4 uint64_t XFFFFFFFFFFFFFFFF a=0;
(GDB) n
Uint32_t b=0 XFFFFFFFF;
(GDB) p a
$1=18446744073709551615
(GDB) p/x a> 64
$2=0 XFFFFFFFFFFFFFFFF
(GDB) p/x a<64
$3=0 XFFFFFFFFFFFFFFFF
(GDB) p/x b> 32
$4=0 x0
(GDB) p/x b<32
$5=0 x0


# include
# include
Int main (void) {
Uint64_t XFFFFFFFFFFFFFFFF a=0;
Uint32_t b=0 XFFFFFFFF;
Printf (" a: % x \ n ", a> 64);
B: printf (" % x \ n ", b> 32);
return 0;
}


32 F, move around 32, will be equal to zero, in theory is 0, understandable
Why 64 F, move around 64, or wait for all F? Should not be equal to zero? O god, thank you very much

CodePudding user response:



GDB debug print information above, here are the source code, just this few lines

CodePudding user response:

In any case, if the RHS is negative or greater than or equal to the ascension of LHS after figures, the behavior is undefined,

https://zh.cppreference.com/w/c/language/operator_arithmetic

CodePudding user response:

https://blog.csdn.net/huqinwei987/article/details/70941199
For your reference ~
  • Related