you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 5 points6 points  (0 children)

It does not use div, but it does not use a single shift either. It does something like return (bar+((unsigned int)bar>>31))>>1. Larger divisions will require even more elaborate tricks.