6 ms·
Replacing compile time constants with function calls will always bring some trouble, suddenly you need to rearrange your structures, optimizations get missed (i
by PhilipRoman 2y ago
Replacing compile time constants with function calls will always bring some trouble, suddenly you need to rearrange your structures, optimizations get missed (in extreme cases you can accidentally introduce a DIV instruction), etc. So it is not surprising that code assumes 4k pages.
- mgaunard 2y agoAny code that does divisions and modulos with non-constants that are known to be powers of 2 should do the optimization manually. Even for non-powers-of-two there are also techniques to speed up divisions if the same divisor is used repeatedly.