A faster way to compute signed 64-bit floor division by constants
Comments
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Ranked by a public rubric, not by votes: what a comment adds counts, not who wrote it. How comments are ranked · Comment rules
Summary
A technical write-up presents a faster method for signed 64-bit floor division (rounding toward negative infinity) when the divisor is a compile-time constant. Existing compilers and many libraries lack native floor division or use slow algorithms, and Hacker's Delight says little about it.