News for hackers. Stuff that matters.
Re:How do compilers optimize divisions? by Someone on Monday February 20, 2017 @06:42PM (#13692030)
On this subject, these three blog posts are hard to beat:

http://ridiculousfish.com/blog/posts/labor-of-division-episo...

http://ridiculousfish.com/blog/posts/labor-of-division-episo...

http://ridiculousfish.com/blog/posts/labor-of-division-episo...

The same author wrote a library for doing this (and more; it also uses bit shifts) at runtime: http://libdivide.com

Of course, that only makes sense if you know you will do lots of divisions by the same number

There are no comments on this comment yet.