Previous | Next --- Slide 38 of 58
Back to Lecture Thumbnails
shabnam

I don't understand the last comment about recomputing intermediate values. Any pointers?

dfarrow

This code implements integer division (for which there is surprisingly no SSE/AVX intrinsic) by integer multiplication. This is a very cool trick called " Division by invariant integers using multiplication", published in 1994 (citation below) and built into GCC. There's a blog post explaining the method here.

Granlund, Torbjörn, and Peter L. Montgomery. "Division by invariant integers using multiplication." ACM SIGPLAN Notices. Vol. 29. No. 6. ACM, 1994.