Merge pull request #129 from fperrad/20181201_lint

more linting
This commit is contained in:
Steffen Jaeckel 2018-12-01 15:26:35 +01:00 committed by GitHub
commit 285b580995
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -24,7 +24,7 @@ int mp_set_double(mp_int *a, double b)
} cast; } cast;
cast.dbl = b; cast.dbl = b;
exp = (unsigned)(cast.bits >> 52) & 0x7FFU; exp = (int)((unsigned)(cast.bits >> 52) & 0x7FFU);
frac = (cast.bits & ((1ULL << 52) - 1ULL)) | (1ULL << 52); frac = (cast.bits & ((1ULL << 52) - 1ULL)) | (1ULL << 52);
if (exp == 0x7FF) { /* +-inf, NaN */ if (exp == 0x7FF) { /* +-inf, NaN */
@ -38,6 +38,10 @@ int mp_set_double(mp_int *a, double b)
} }
res = (exp < 0) ? mp_div_2d(a, -exp, a, NULL) : mp_mul_2d(a, exp, a); res = (exp < 0) ? mp_div_2d(a, -exp, a, NULL) : mp_mul_2d(a, exp, a);
if (res != MP_OKAY) {
return res;
}
if (((cast.bits >> 63) != 0ULL) && (mp_iszero(a) == MP_NO)) { if (((cast.bits >> 63) != 0ULL) && (mp_iszero(a) == MP_NO)) {
SIGN(a) = MP_NEG; SIGN(a) = MP_NEG;
} }