Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


Any 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: