From 034cd1f444104f92fd19bfcdd5afcbfc2782a5ea Mon Sep 17 00:00:00 2001 From: Francois Perrad Date: Wed, 28 Nov 2018 10:44:22 +0100 Subject: [PATCH] explicit comparison --- bn_mp_get_double.c | 2 +- bn_mp_set_double.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bn_mp_get_double.c b/bn_mp_get_double.c index ea78b9f..a192fb1 100644 --- a/bn_mp_get_double.c +++ b/bn_mp_get_double.c @@ -23,7 +23,7 @@ double mp_get_double(const mp_int *a) for (i = USED(a); i --> 0;) { d = d * fac + (double)DIGIT(a, i); } - return mp_isneg(a) ? -d : d; + return (mp_isneg(a) != MP_NO) ? -d : d; } #endif diff --git a/bn_mp_set_double.c b/bn_mp_set_double.c index 0a5f771..6b847a5 100644 --- a/bn_mp_set_double.c +++ b/bn_mp_set_double.c @@ -38,7 +38,7 @@ int mp_set_double(mp_int *a, double d) } res = exp < 0 ? mp_div_2d(a, -exp, a, 0) : mp_mul_2d(a, exp, a); - if ((cast.bits >> 63) && !mp_iszero(a)) { + if (((cast.bits >> 63) != 0ULL) && (mp_iszero(a) == MP_NO)) { SIGN(a) = MP_NEG; }