Re:Low Level Bit Hacks You Absolutely Must Know
by BearOso on Friday May 11, 2018 @01:33PM
(#17049257)
I highly doubt it. That’s 1:1
[ Parent
| on HN ]
Re:Low Level Bit Hacks You Absolutely Must Know
by Hello71 on Friday May 11, 2018 @06:33PM
(#17051203)
gcc -O2, clang, and icc all produce the sequence:
is_even(int):
mov eax, edi
not eax
and eax, 1
ret
I am far from a x86 expert, but I assume this version avoids contention on the flags registers and increases pipelining.edit: my mistake, icc and clang produce the equivalent sequence "not edi; and edi, 1; mov eax, edi; ret".