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

I think all modern compilers do this now. I know the D compiler does:

https://github.com/D-Programming-Language/dmd/blob/master/sr...



Modern compilers do some variant of fast integer division by constants, but I think most use the "round-up" algorithm described in an earlier post in this series (http://ridiculousfish.com/blog/posts/labor-of-division-episo...) and a variety of other places and not the "round-down" algorithm described in this post when the multiplier is a bit too big. You'd know better than I, but it looks like this is the round-up algorithm: https://github.com/D-Programming-Language/dmd/blob/master/sr...




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

Search: