Re:The gold standard of optimization: A look under the hood ...
by dmitrygr on Monday March 23, 2026 @01:38AM
(#47485825)
they will do it for unsigned. for signed they will do a bit more to do the same rounding as C promises
Re:The gold standard of optimization: A look under the hood ...
by grumbelbart2 on Monday March 23, 2026 @08:55AM
(#47488836)
Here is how that looks like:
Re:The gold standard of optimization: A look under the hood ...
by account42 on Monday March 23, 2026 @10:25AM
(#47490016)
It's unfortunate that C tied overflow behavior to the signedness of integer types.
Re:The gold standard of optimization: A look under the hood ...
by mid-kid on Monday March 23, 2026 @08:20AM
(#47488442)
Yeah. I'm surprised this along with the money thing are listed in the article at all. These are the sort of things you learn within the first month of writing assembly, and were widely used across the industry at the time (and times prior). The bit shifting optimization is performed by GCC even at -O0, and likely already was at the time, as it's one of the simpler optimizations to make. It's like calling "xor eax, eax" a masterful optimization tactic for clearing a register.
Looking at the macro-level optimizations like the rest of the article does is significantly more interesting.
Re:The gold standard of optimization: A look under the hood ...
by ConceptJunkie on Monday March 23, 2026 @12:51PM
(#47492003)
"XOR AXAX" was my license plate in the 90s.
Re:The gold standard of optimization: A look under the hood ...
by dmitrygr on Monday March 23, 2026 @04:27PM
(#47494657)
I had "PUSH EAX" and "BX LR" :)
(emphasis mine)
Not at all true. Assuming the types are such that >> is equivalent to /, modern compilers will implement division by a power of two as a shift every single time.