Godbolt link -- as you can see, in the assembly code of the first function z
, the two lines xor rax, 63; xor rax, 63
are redundant, and should be removed; while the code for function u
is optimal.
Related issue on GitHub. (not the same as this issue)
For reference, clang can optimize the equivalent C++ code well.
Is there any other way to count the number of significant bits in the number?