X-Git-Url: https://git.saurik.com/apple/libc.git/blobdiff_plain/b5d655f7532a546b54809da387f7467d128a756b..fbd86d4cc20b02a10edcca92fb7ae0a143e63cc4:/gdtoa/FreeBSD/_hdtoa.c.patch diff --git a/gdtoa/FreeBSD/_hdtoa.c.patch b/gdtoa/FreeBSD/_hdtoa.c.patch index 4e14727..69173cd 100644 --- a/gdtoa/FreeBSD/_hdtoa.c.patch +++ b/gdtoa/FreeBSD/_hdtoa.c.patch @@ -1,5 +1,5 @@ ---- _hdtoa.c.orig 2008-03-15 10:50:51.000000000 -0700 -+++ _hdtoa.c 2008-03-27 00:55:34.000000000 -0700 +--- _hdtoa.c.orig 2008-09-07 11:38:10.000000000 -0700 ++++ _hdtoa.c 2008-09-07 12:49:47.000000000 -0700 @@ -55,7 +55,7 @@ roundup(char *s0, int ndigits) *s = 1; return (1); @@ -9,6 +9,30 @@ } ++*s; return (0); +@@ -126,12 +126,12 @@ __hdtoa(double d, const char *xdigs, int + static const int sigfigs = (DBL_MANT_DIG + 3) / 4; + union IEEEd2bits u; + char *s, *s0; +- int bufsize; ++ int bufsize, f; + + u.d = d; + *sign = u.bits.sign; + +- switch (fpclassify(d)) { ++ switch (f = fpclassify(d)) { + case FP_NORMAL: + *decpt = u.bits.exp - DBL_ADJ; + break; +@@ -149,7 +149,7 @@ __hdtoa(double d, const char *xdigs, int + *decpt = INT_MAX; + return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1)); + default: +- abort(); ++ LIBC_ABORT("fpclassify returned %d", f); + } + + /* FP_NORMAL or FP_SUBNORMAL */ @@ -210,6 +210,7 @@ __hdtoa(double d, const char *xdigs, int return (s0); } @@ -17,10 +41,12 @@ #if (LDBL_MANT_DIG > DBL_MANT_DIG) /* -@@ -223,12 +224,17 @@ __hldtoa(long double e, const char *xdig +@@ -222,13 +223,18 @@ __hldtoa(long double e, const char *xdig + static const int sigfigs = (LDBL_MANT_DIG + 3) / 4; union IEEEl2bits u; char *s, *s0; - int bufsize; +- int bufsize; ++ int bufsize, f; +#ifdef LDBL_HEAD_TAIL_PAIR + uint32_t bits[4]; + int i, pos; @@ -29,18 +55,28 @@ u.e = e; *sign = u.bits.sign; - switch (fpclassify(e)) { +- switch (fpclassify(e)) { ++ switch (f = fpclassify(e)) { case FP_NORMAL: + case FP_SUPERNORMAL: *decpt = u.bits.exp - LDBL_ADJ; break; case FP_ZERO: +@@ -245,7 +251,7 @@ __hldtoa(long double e, const char *xdig + *decpt = INT_MAX; + return (nrv_alloc(NANSTR, rve, sizeof(NANSTR) - 1)); + default: +- abort(); ++ LIBC_ABORT("fpclassify returned %d", f); + } + + /* FP_NORMAL or FP_SUBNORMAL */ @@ -270,6 +276,19 @@ __hldtoa(long double e, const char *xdig */ for (s = s0 + bufsize - 1; s > s0 + sigfigs - 1; s--) *s = 0; +#ifdef LDBL_HEAD_TAIL_PAIR -+ _ldbl2array32dd(u, bits); ++ *decpt -= _ldbl2array32dd(u, bits); + i = 0; + pos = 8; + for (; s > s0; s--) {