3 ms·
A compiler I use, based on lcc, did this automatically without even enabling optimizations. The division is transformed into multiplication and a right shift.
by readerrrr 12y ago
A compiler I use, based on lcc, did this automatically without even enabling optimizations.
The division is transformed into multiplication and a right shift.
I don't think your usual programmer must care about that with the modern compilers, but it is nice to know if you are implementing one or you are coding in asm.
- clarry 12y agoOr if you're dealing with data that isn't compile-time constant, but can be expected to remain unchanged for the duration of something that needs to be optimized all the way.