4 ms·
> Many compilers even expand the code inline to generate fix size divides into mult and shift. Specificly, u8 divmod 58 can be reduced to a u8->u16 multiply, a
by a1369209993 8y ago
> Many compilers even expand the code inline to generate fix size divides into mult and shift.
Specificly, u8 divmod 58 can be reduced to a u8->u16 multiply, a right shift, and three conditional subtractions; that's not great, but on a modern CPU it's a afterthought compared to the quadratic loop over the input size.