]> git.proxmox.com Git - wasi-libc.git/commitdiff
Fix floatscan no long double usage (#21)
authorvms <michail.vms@gmail.com>
Mon, 22 Apr 2019 21:37:03 +0000 (00:37 +0300)
committerDan Gohman <sunfish@mozilla.com>
Mon, 22 Apr 2019 21:37:03 +0000 (14:37 -0700)
* fix long double using in floatscan

* define separate macroses for copysignl, fmodl, and scalbnl instead of #ifndef

libc-top-half/headers/private/printscan.h
libc-top-half/musl/src/internal/floatscan.c

index 273bc8eddc8bd0661759ec073ab00bafe9d3b54e..af8cf89b017964d2793b3258ebedd9b9d9c22c54 100644 (file)
@@ -37,6 +37,12 @@ typedef double long_double;
 #define LDBL_MAX_10_EXP DBL_MAX_10_EXP
 #undef frexpl
 #define frexpl(x, exp) frexp(x, exp)
+#undef copysignl
+#define copysignl(x, y) copysign(x, y)
+#undef fmodl
+#define fmodl(x, y) fmod(x, y)
+#undef scalbnl
+#define scalbnl(arg, exp) scalbn(arg, exp)
 __attribute__((__cold__, __noreturn__))
 static void long_double_not_supported(void) {
     void abort(void) __attribute__((__noreturn__));
index 3de2df5da0f94c4066bd07feb68f9a04959a7515..7fd0060b20c4d56fb21498161d63b97a5047333c 100644 (file)
@@ -287,7 +287,11 @@ static long double decfloat(FILE *f, int c, int bits, int emin, int sign, int po
        /* Assemble desired bits into floating point variable */
        for (y=i=0; i<LD_B1B_DIG; i++) {
                if ((a+i & MASK)==z) x[(z=(z+1 & MASK))-1] = 0;
+#if defined(__wasilibc_printscan_no_long_double)
+               y = 1000000000.0 * y + x[a+i & MASK];
+#else
                y = 1000000000.0L * y + x[a+i & MASK];
+#endif
        }
 
        y *= sign;