commit eeda1a1396eb2732e8fe9234bd13d21ac334cfac (tree) parent 0ab4afbf4236e6823be6b8845b7e9fa77f7c61f9 Author: Isaac Hier <isaachier@gmail.com> Date: Thu, 21 Jun 2018 08:17:08 -0400 Fix logic Diffstat:
| M | src/bigint.cpp | | | 13 | ++++--------- |
1 file changed, 4 insertions(+), 9 deletions(-)
diff --git a/src/bigint.cpp b/src/bigint.cpp @@ -1685,16 +1685,11 @@ void bigint_incr(BigInt *x) { } if (x->digit_count == 1) { - if (x->is_negative) { - if (x->data.digit != 0) { - x->data.digit -= 1; - } + if (x->is_negative && x->data.digit != 0) { + x->data.digit -= 1; return; - } - else { - if (x->data.digit != UINT64_MAX) { - x->data.digit += 1; - } + } else if (!x->is_negative && x->data.digit != UINT64_MAX) { + x->data.digit += 1; return; } }