summaryrefslogtreecommitdiffstats
path: root/src/bignum.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/bignum.c')
-rw-r--r--src/bignum.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/bignum.c b/src/bignum.c
index bd1bd71..8a622c1 100644
--- a/src/bignum.c
+++ b/src/bignum.c
@@ -174,7 +174,7 @@ init_digit_blocks(void)
for (base = 2; base <= 36; base++)
{
- tmp = ((1 << (DIGIT_BITS - 1)) / base);
+ tmp = ((1U << (DIGIT_BITS - 1)) / base);
maxdigit = tmp * 2;
curdigit = 1;
digcnt = 0;
@@ -424,6 +424,7 @@ static int
ucompare_digits(bignum *a, bignum *b)
{
DIGIT *a_ptr, *b_ptr;
+ int retval = 0;
if (a->dgs_used == b->dgs_used)
{
@@ -436,12 +437,14 @@ ucompare_digits(bignum *a, bignum *b)
}
if (a_ptr < a->dp)
{
- return 0;
+ return retval;
}
else
{
- return (*a_ptr > *b_ptr) ? 1 : -1;
+ if (retval == 0)
+ retval = (*a_ptr > *b_ptr) ? 1 : -1;
}
+ return retval;
}
return (a->dgs_used > b->dgs_used) ? 1 : -1;
}