3 ms·
min() is a special case: on most modern architectures (x86, ARM, etc), the naive code will compile optimally. Example on x86: cmp eax, ebx cmovg eax
by DarkShikari 15y ago
min() is a special case: on most modern architectures (x86, ARM, etc), the naive code will compile optimally. Example on x86:
cmp eax, ebx
cmovg eax, ebx
The compiler will likely not understand the insane bit-hack method, which is much more complicated, and thus not parse it into a simple cmov sequence.