Faster remainders when the divisor is a constant: beating compilers and libdivide
Daniel Lemire
FEBRUARY 8, 2019
I believe that all optimizing C/C++ compilers know how to pull this trick and it is generally beneficial irrespective of the processor’s architecture. It has now been worked out in a paper to appear in Software: Practice and Experience called Faster Remainder by Direct Computation. return n * c < = c - 1 ; }.
Let's personalize your content