summaryrefslogtreecommitdiffstats
path: root/lib/mpi/mpi-cmp.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mpi/mpi-cmp.c')
-rw-r--r--lib/mpi/mpi-cmp.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/mpi/mpi-cmp.c b/lib/mpi/mpi-cmp.c
index d25e9e96c..ceaebe181 100644
--- a/lib/mpi/mpi-cmp.c
+++ b/lib/mpi/mpi-cmp.c
@@ -25,8 +25,12 @@ int mpi_cmp_ui(MPI u, unsigned long v)
mpi_limb_t limb = v;
mpi_normalize(u);
- if (!u->nlimbs && !limb)
- return 0;
+ if (u->nlimbs == 0) {
+ if (v == 0)
+ return 0;
+ else
+ return -1;
+ }
if (u->sign)
return -1;
if (u->nlimbs > 1)