authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-22 16:06:18-04:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2019-03-22 16:06:18-04:00
log71c78cc9cfbcefa165882326a9b90efacf107216
tree817145a6d2dc74867fa814a65dfd21451d716103
parent4615ed5ea003516c8235728ac3f5f0ee2ccea8a7
signature Commit is signed but in an unrecognized format.

avoid quad float literal syntax for MSVC


1 files changed, 12 insertions(+), 11 deletions(-)

src/parse_f128.c+12-11
......@@ -347,10 +347,11 @@ static void mul_eq_f128_int(float128_t *y, int sign) {
347347 *y = new_value;
348348}
349349
350static float128_t literal_f128(__float128 x) {
351 float128_t result;
352 memcpy(&result, &x, 16);
353 return result;
350static float128_t make_f128(uint64_t hi, uint64_t lo) {
351 union ldshape ux;
352 ux.i2.hi = hi;
353 ux.i2.lo = lo;
354 return ux.f;
354355}
355356
356357static void mul_eq_f128_f128(float128_t *a, float128_t b) {
......@@ -377,11 +378,11 @@ static float128_t scalbnf128(float128_t x, int n)
377378
378379 if (n > 16383) {
379380 //x *= 0x1p16383q;
380 mul_eq_f128_f128(&x, literal_f128(0x1p16383q));
381 mul_eq_f128_f128(&x, make_f128(0x7ffe000000000000, 0x0000000000000000));
381382 n -= 16383;
382383 if (n > 16383) {
383384 //x *= 0x1p16383q;
384 mul_eq_f128_f128(&x, literal_f128(0x1p16383q));
385 mul_eq_f128_f128(&x, make_f128(0x7ffe000000000000, 0x0000000000000000));
385386 n -= 16383;
386387 if (n > 16383)
387388 n = 16383;
......@@ -390,8 +391,8 @@ static float128_t scalbnf128(float128_t x, int n)
390391 //x *= 0x1p-16382q * 0x1p113q;
391392 {
392393 float128_t mul_result;
393 float128_t a = literal_f128(0x1p-16382q);
394 float128_t b = literal_f128(0x1p113q);
394 float128_t a = make_f128(0x0001000000000000, 0x0000000000000000);
395 float128_t b = make_f128(0x4070000000000000, 0x0000000000000000);
395396 f128M_mul(&a, &b, &mul_result);
396397 mul_eq_f128_f128(&x, mul_result);
397398 }
......@@ -400,8 +401,8 @@ static float128_t scalbnf128(float128_t x, int n)
400401 //x *= 0x1p-16382q * 0x1p113q;
401402 {
402403 float128_t mul_result;
403 float128_t a = literal_f128(0x1p-16382q);
404 float128_t b = literal_f128(0x1p113q);
404 float128_t a = make_f128(0x0001000000000000, 0x0000000000000000);
405 float128_t b = make_f128(0x4070000000000000, 0x0000000000000000);
405406 f128M_mul(&a, &b, &mul_result);
406407 mul_eq_f128_f128(&x, mul_result);
407408 }
......@@ -728,7 +729,7 @@ static float128_t decfloat(struct MuslFILE *f, int c, int bits, int emin, int si
728729 if ((e2+LDBL_MANT_DIG & INT_MAX) > emax-5) {
729730 //if (fabsf128(y) >= 0x1p113)
730731 float128_t abs_y = fabsf128(y);
731 float128_t mant_f128 = literal_f128(0x1p113q);
732 float128_t mant_f128 = make_f128(0x4070000000000000, 0x0000000000000000);
732733 if (!f128M_lt(&abs_y, &mant_f128)) {
733734 if (denormal && bits==LDBL_MANT_DIG+e2-emin)
734735 denormal = 0;