From fd2f516a5dae187ec37ec610249e5fa9c0b17018 Mon Sep 17 00:00:00 2001 From: Sam Cappleman-Lynes Date: Thu, 29 Jun 2017 09:56:15 +0100 Subject: [PATCH] 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. --- bigint/src/biguint.rs | 2 ++ bigint/src/tests/biguint.rs | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/bigint/src/biguint.rs b/bigint/src/biguint.rs index 3063236..ffe14e0 100644 --- a/bigint/src/biguint.rs +++ b/bigint/src/biguint.rs @@ -460,6 +460,8 @@ impl<'a, 'b> Mul<&'b BigUint> for &'a BigUint { } } +forward_all_scalar_binop_to_val_val!(impl Mul for BigUint, mul); + impl Mul for BigUint { type Output = BigUint; diff --git a/bigint/src/tests/biguint.rs b/bigint/src/tests/biguint.rs index f3627fa..da6c956 100644 --- a/bigint/src/tests/biguint.rs +++ b/bigint/src/tests/biguint.rs @@ -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); } } }