diff --git a/src/int/sdiv.rs b/src/int/sdiv.rs index 51d9c37..d00f89a 100644 --- a/src/int/sdiv.rs +++ b/src/int/sdiv.rs @@ -55,7 +55,9 @@ macro_rules! divmod { #[cfg(all(feature = "c", any(target_arch = "x86")))] () => unsafe { $div(a, b) }, }; - *rem = a - (r * b); + // NOTE won't overflow because it's using the result from the + // previous division + *rem = a - r.wrapping_mul(b); r } }