5 ms·
This is a good example of a pointless "optimization" making the code harder to read. If he had indeed meant that, he should have written x = ~x + 1; GCC,
by efaref 10y ago
This is a good example of a pointless "optimization" making the code harder to read.
If he had indeed meant that, he should have written
x = ~x + 1;
GCC, even with optimisation turned off, will turn that into a negl instruction.
- joosters 10y agoHe mentions Visual Studio often in the page, and the code is several years old. Perhaps your alternative doesn't optimise well across the compilers he used, back several years ago when the author was developing the code. In any case, there are unknowns here. Perhaps you should be less hasty in declaring people's work 'pointless' and telling others what they 'should' have done?