News for hackers. Stuff that matters.
Re:How do compilers optimize divisions? by raphlinus on Tuesday February 21, 2017 @01:54PM (#13698313)
An even trickier way to do this is to rotate right by the power of two factor between doing the multiply and the compare.
Re:How do compilers optimize divisions? by im3w1l on Thursday February 23, 2017 @02:17AM (#13712246)
That wouldn't work, because a number that is bigger than the threshold could become smaller than it after the rotation.