use type-cast in stead of UINT64_C

This commit is contained in:
Jan Nijtmans 2019-11-06 11:52:42 +01:00 committed by Steffen Jaeckel
parent 02aa95c2b5
commit 9cfb6c3298
No known key found for this signature in database
GPG Key ID: AF0CB17621EDAD72
2 changed files with 2 additions and 2 deletions

View File

@ -690,7 +690,7 @@ static int test_mp_get_u64(void)
DOR(mp_init_multi(&a, &b, NULL));
for (i = 0; i < (int)(MP_SIZEOF_BITS(uint64_t) - 1); ++i) {
r = (UINT64_C(1) << (i+1)) - 1;
r = ((uint64_t)1 << (i+1)) - 1;
if (!r)
r = UINT64_MAX;
printf(" r = 0x%" PRIx64 " i = %d\r", r, i);

View File

@ -16,7 +16,7 @@ mp_err mp_set_double(mp_int *a, double b)
cast.dbl = b;
exp = (int)((unsigned)(cast.bits >> 52) & 0x7FFu);
frac = (cast.bits & ((UINT64_C(1) << 52) - UINT64_C(1))) | (UINT64_C(1) << 52);
frac = (cast.bits & (((uint64_t)1 << 52) - (uint64_t)1)) | ((uint64_t)1 << 52);
if (exp == 0x7FF) { /* +-inf, NaN */
return MP_VAL;