All variants of multiplying BigUint by BigDigit
Allow the multiplication to occur with either operand order and with any combination of owned and borrowed arguments.
This commit is contained in:
parent
e5ed503141
commit
fd2f516a5d
|
@ -460,6 +460,8 @@ impl<'a, 'b> Mul<&'b BigUint> for &'a BigUint {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
forward_all_scalar_binop_to_val_val!(impl Mul<BigDigit> for BigUint, mul);
|
||||||
|
|
||||||
impl Mul<BigDigit> for BigUint {
|
impl Mul<BigDigit> for BigUint {
|
||||||
type Output = BigUint;
|
type Output = BigUint;
|
||||||
|
|
||||||
|
|
|
@ -822,13 +822,15 @@ fn test_scalar_mul() {
|
||||||
if a_vec.len() == 1 {
|
if a_vec.len() == 1 {
|
||||||
let b = BigUint::from_slice(b_vec);
|
let b = BigUint::from_slice(b_vec);
|
||||||
let a = a_vec[0];
|
let a = a_vec[0];
|
||||||
assert!(b * a == c);
|
assert_op!(a * b == c);
|
||||||
|
assert_op!(b * a == c);
|
||||||
}
|
}
|
||||||
|
|
||||||
if b_vec.len() == 1 {
|
if b_vec.len() == 1 {
|
||||||
let a = BigUint::from_slice(a_vec);
|
let a = BigUint::from_slice(a_vec);
|
||||||
let b = b_vec[0];
|
let b = b_vec[0];
|
||||||
assert!(a * b == c);
|
assert_op!(a * b == c);
|
||||||
|
assert_op!(b * a == c);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue