4 ms·
The problem efficiency wise is that modulo (and any other form of division) is really slow. Therefore a binary version of this algorithm exist that only do divi
by yxhuvud 6y ago
The problem efficiency wise is that modulo (and any other form of division) is really slow. Therefore a binary version of this algorithm exist that only do divison by 2, which is faster as it can be implemented by using a shift instruction.