What's the purpose of looping “xorl %edx,%eax; shrl $1,%edx”?
问题 I have the following x86 assembly code: movl 8(%ebp), %edx //get an argument from the caller movl $0, %eax testl %edx, %edx je .L1 .L2: // what's the purpose of this loop body? xorl %edx, %eax shrl $1, %edx jne .L2 .L1: andl $1, %eax The corresponding C code that the textbook gives as follows int f1(unsigned x) { int y = 0; while(x != 0) { __________; } return __________; } The book asks readers to fill the blank and answer the question of "What does it do?" I can't combine the loop body in