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:
Sam Cappleman-Lynes 2017-06-29 09:56:15 +01:00
parent e5ed503141
commit fd2f516a5d
2 changed files with 6 additions and 2 deletions

View File

@ -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 {
type Output = BigUint;

View File

@ -822,13 +822,15 @@ fn test_scalar_mul() {
if a_vec.len() == 1 {
let b = BigUint::from_slice(b_vec);
let a = a_vec[0];
assert!(b * a == c);
assert_op!(a * b == c);
assert_op!(b * a == c);
}
if b_vec.len() == 1 {
let a = BigUint::from_slice(a_vec);
let b = b_vec[0];
assert!(a * b == c);
assert_op!(a * b == c);
assert_op!(b * a == c);
}
}
}