Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
WalterBright
on Sept 25, 2014
|
parent
|
context
|
favorite
| on:
Faster Unsigned Division by Constants (2011)
I think all modern compilers do this now. I know the D compiler does:
https://github.com/D-Programming-Language/dmd/blob/master/sr...
simonster
on Sept 25, 2014
[–]
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:
https://github.com/D-Programming-Language/dmd/blob/master/sr...