3 ms·
I'm not arguing against plain C - for example I'll always write blsi as `n & -n` because I trust the compiler to recognize that pattern. The problem I have is
by Veedrac 10y ago
I'm not arguing against plain C - for example I'll always write blsi as `n & -n` because I trust the compiler to recognize that pattern.
The problem I have is the claim that the compiler knows better than me, or any programmer with even fairly basic knowledge of the underlying hardware. The only reason to write `reverse_actually_fast_c` like that is because you know of the bswap instruction. If there was no bswap instruction on the target you support, this would hardly be the ideal implementation!
Even if you write it indirectly and verbosely, you're still picking out specific assembly instructions. You're giving instructions to a machine.