mirror of
https://github.com/uutils/coreutils
synced 2024-11-17 18:28:18 +00:00
factor::numeric: Simplify inv_mod_u64
Just call `u64::wrapping_{mul,sub}` instead of (de)constructing Wrapping<u64> values.
This commit is contained in:
parent
918035e01e
commit
19a0645a0a
1 changed files with 4 additions and 4 deletions
|
@ -173,12 +173,12 @@ pub(crate) fn inv_mod_u64(a: u64) -> u64 {
|
|||
r
|
||||
} / newr;
|
||||
|
||||
let (tp, Wrapping(newtp)) = (newt, Wrapping(t) - (Wrapping(quot) * Wrapping(newt)));
|
||||
t = tp;
|
||||
let newtp = t.wrapping_sub(quot.wrapping_mul(newt));
|
||||
t = newt;
|
||||
newt = newtp;
|
||||
|
||||
let (rp, Wrapping(newrp)) = (newr, Wrapping(r) - (Wrapping(quot) * Wrapping(newr)));
|
||||
r = rp;
|
||||
let newrp = r.wrapping_sub(quot.wrapping_mul(newr));
|
||||
r = newr;
|
||||
newr = newrp;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue