aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/math/bigint/big_ops3.cpp
diff options
context:
space:
mode:
authorJack Lloyd <[email protected]>2018-08-23 10:02:18 -0400
committerJack Lloyd <[email protected]>2018-08-23 10:02:18 -0400
commit2de92b238374fd37ba5001aaabac68782bae77b1 (patch)
tree562e93078cbdef4e4ca5872cff5b7de6d441b33e /src/lib/math/bigint/big_ops3.cpp
parentc784b6a77f99512ae53de55fd0b5fe78c473cfdd (diff)
parent265e0ca5af869710804dc1b7870a27d4e0ffe1b6 (diff)
Merge GH #1656 Add operator*(BigInt,word)
Diffstat (limited to 'src/lib/math/bigint/big_ops3.cpp')
-rw-r--r--src/lib/math/bigint/big_ops3.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/lib/math/bigint/big_ops3.cpp b/src/lib/math/bigint/big_ops3.cpp
index 492a69ad0..3f34e0bf1 100644
--- a/src/lib/math/bigint/big_ops3.cpp
+++ b/src/lib/math/bigint/big_ops3.cpp
@@ -126,6 +126,24 @@ BigInt operator*(const BigInt& x, const BigInt& y)
}
/*
+* Multiplication Operator
+*/
+BigInt operator*(const BigInt& x, word y)
+ {
+ const size_t x_sw = x.sig_words();
+
+ BigInt z(BigInt::Positive, x_sw + 1);
+
+ if(x_sw && y)
+ {
+ bigint_linmul3(z.mutable_data(), x.data(), x_sw, y);
+ z.set_sign(x.sign());
+ }
+
+ return z;
+ }
+
+/*
* Division Operator
*/
BigInt operator/(const BigInt& x, const BigInt& y)