Improve overall performance (#6699)

* Improve overall performance

* Clean up code

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove needless ::

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>

* Remove needless ::

Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: Kian Paimani <5588131+kianenigma@users.noreply.github.com>
This commit is contained in:
pscott
2020-07-21 14:46:49 +02:00
committed by GitHub
parent ab82eb1c98
commit 046fda914a
73 changed files with 141 additions and 144 deletions
@@ -48,8 +48,8 @@ fn main() {
digits_u.reverse();
digits_v.reverse();
let num_u = num_bigint::BigUint::new(digits_u.clone());
let num_v = num_bigint::BigUint::new(digits_v.clone());
let num_u = num_bigint::BigUint::new(digits_u);
let num_v = num_bigint::BigUint::new(digits_v);
if check_digit_lengths(&u, &v, 4) {
assert_eq!(u.cmp(&v), ue.cmp(&ve));
@@ -146,14 +146,14 @@ fn main() {
// Division
if v.len() == 1 && v.get(0) != 0 {
let w = u.clone().div_unit(v.get(0));
let num_w = num_u.clone() / &num_v;
let w = u.div_unit(v.get(0));
let num_w = num_u / &num_v;
assert_biguints_eq(&w, &num_w);
} else if u.len() > v.len() && v.len() > 0 {
let num_remainder = num_u.clone() % num_v.clone();
let (w, remainder) = u.clone().div(&v, return_remainder).unwrap();
let num_w = num_u.clone() / &num_v;
let (w, remainder) = u.div(&v, return_remainder).unwrap();
let num_w = num_u / &num_v;
assert_biguints_eq(&w, &num_w);