Daniel Lemire personal blog

Ideal divisors: when a division compiles down to just a multiplication

The division instruction is one of the most expensive instruction in your CPU. Thus optimizing compilers often compile divisions by known constants down to a multiplication followed by a shift. However, in some lucky cases, the compiler does not even need a shift. I call the corresponding divisors ideal. For the math…
Points
141
HN comments
67
Submissions
1
Cited by
0 commenters

Software EngineeringSystems & Performance2021

On Hacker News

SubmittedTitle on HNPointsComments
Apr 28, 2021Ideal divisors: when a division compiles down to just a multiplication by chmaynard14167

More from Daniel Lemire

All 87 posts →

Related posts from the same era