Sunday 15 June 2014

c - Hexadecimal and binary representation (64bits) -



c - Hexadecimal and binary representation (64bits) -

i work on 64bits computer , seek manipulate integer binary representation :

uint64_t x = 0x11d (100011101) , check if bits equals 0 or 1, wrote next loop :

for(i=63; i>=0; i--){ if ( x & (1u << i) ) printf("%d ,", i); }

but when execute it, find 40, 36, 35, 34, 32, 8, 4, 3, 2, 0 should find 8, 4, 3, 2 ,0... not understand going on think it's 64bits , 32bits representation, right ? how can solve problem , ignore previous bits (40, 36, 35 ,34,32) ?

thank much help ! :)

c binary bit representation

No comments:

Post a Comment