aboutsummaryrefslogtreecommitdiff
path: root/src/bigint.cpp
diff options
context:
space:
mode:
authorJimmi Holst Christensen <jhc@liab.dk>2018-01-17 14:00:27 +0100
committerJimmi Holst Christensen <jhc@liab.dk>2018-01-17 14:00:27 +0100
commitdb0fc32ab2d5277655a87200be8f602473ed30d2 (patch)
treedd69bb34da92f00ff0b76bd638113188c0327cfc /src/bigint.cpp
parent1eda7e0fde88ac06eaf595f74157d1e6214c1b3d (diff)
downloadzig-db0fc32ab2d5277655a87200be8f602473ed30d2.tar.gz
zig-db0fc32ab2d5277655a87200be8f602473ed30d2.zip
fixed xor with zero
Diffstat (limited to 'src/bigint.cpp')
-rw-r--r--src/bigint.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/bigint.cpp b/src/bigint.cpp
index a68dd3a4b8..05c6463aa3 100644
--- a/src/bigint.cpp
+++ b/src/bigint.cpp
@@ -1271,6 +1271,12 @@ void bigint_and(BigInt *dest, const BigInt *op1, const BigInt *op2) {
}
void bigint_xor(BigInt *dest, const BigInt *op1, const BigInt *op2) {
+ if (op1->digit_count == 0) {
+ return bigint_init_bigint(dest, op2);
+ }
+ if (op2->digit_count == 0) {
+ return bigint_init_bigint(dest, op1);
+ }
if (op1->is_negative || op2->is_negative) {
// TODO this code path is untested
size_t big_bit_count = max(bigint_bits_needed(op1), bigint_bits_needed(op2));