An optimizing compiler will turn div-by-constant and mod-by-constant into multiplications and bitshifts. For example, the Rust compiler: https://play.rust-lang.org/?version=stable&mode=release&edit... (select "Show assembly" on the top-left button).
pub fn divmod10(x: u32) -> (u32, u32) {
(x / 10, x % 10)
}
generates mov ecx, edi
mov eax, 3435973837
imul rax, rcx
shr rax, 35
lea ecx, [rax + rax]
lea ecx, [rcx + 4\*rcx]
sub edi, ecx
mov edx, edi
ret