diff options
| author | Jimmi Holst Christensen <jhc@liab.dk> | 2018-01-17 14:00:27 +0100 |
|---|---|---|
| committer | Jimmi Holst Christensen <jhc@liab.dk> | 2018-01-17 14:00:27 +0100 |
| commit | db0fc32ab2d5277655a87200be8f602473ed30d2 (patch) | |
| tree | dd69bb34da92f00ff0b76bd638113188c0327cfc /src/bigint.cpp | |
| parent | 1eda7e0fde88ac06eaf595f74157d1e6214c1b3d (diff) | |
| download | zig-db0fc32ab2d5277655a87200be8f602473ed30d2.tar.gz zig-db0fc32ab2d5277655a87200be8f602473ed30d2.zip | |
fixed xor with zero
Diffstat (limited to 'src/bigint.cpp')
| -rw-r--r-- | src/bigint.cpp | 6 |
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)); |
