All Questions
Tagged with bitwise-operators assembly
2 questions
2
votes
3
answers
303
views
Is there any low level way to get shifted or unshifted bits which results from bitwise operations?
I was playing with bitwise operations and a question about counting true bits of any positive integer value, so I solved the problem with bit shifting, so I just thought if there would be some way to ...
2
votes
2
answers
217
views
gcc -S seems a bit misshapen with shifting and ANDing bits
Example:
int c = 4;
int p = 5;
if (p & (1 << c))
printf("ok\n");
else
printf("nop\n");
gcc -S:
movl -4(%rbp), %eax /* eax holds the variable c */
movl -8(%rbp), %edx /* ...