1 --- gdtoa-hexnan.c.orig 2005-01-20 20:12:36.000000000 -0800
2 +++ gdtoa-hexnan.c 2005-06-10 17:43:17.000000000 -0700
4 * with " at " changed at "@" and " dot " changed to "."). */
12 hexnan( CONST char **sp, FPI *fpi, ULong *x0)
15 - ULong c, h, *x, *x1, *xe;
19 - int havedig, hd0, i, nbits;
24 - x = x0 + (nbits >> kshift);
29 - havedig = hd0 = i = 0;
30 + if (sp == NULL || *sp == NULL || **sp != '(')
33 - while(c = *(CONST unsigned char*)++s) {
34 - if (!(h = hexdig[c])) {
36 - if (hd0 < havedig) {
37 - if (x < x1 && i < 8)
50 - if (/*(*/ c == ')' && havedig) {
54 + if ((cp = strchr(s + 1, ')')) == NULL) {
60 + cp = alloca(len + 1);
71 - *x = (*x << 4) | h & 0xf;
72 + strlcpy(cp, s + 1, len + 1);
77 - if (x < x1 && i < 8)
87 + if (nbits == 52) { /* double */
90 + x0[1] = u.bits.manh;
91 + x0[0] = u.bits.manl;
94 - /* truncate high-order word if necessary */
95 - if ( (i = nbits & (ULbits-1)) !=0)
96 - *xe &= ((ULong)0xffffffff) >> (ULbits - i);
97 + else if (nbits < 52) { /* float */
100 + x0[0] = u.bits.man;
102 - for(x1 = xe;; --x1) {
109 + else { /* long double */
110 + union IEEEl2bits u;
112 +#if defined(__ppc__) || defined(__ppc64__)
113 + x0[3] = (ULong)(u.bits.manh >> 44);
114 + x0[2] = (ULong)(u.bits.manh >> 12);
115 + x0[1] = ((ULong)u.bits.manh & 0xfff) << 20 | (ULong)(u.bits.manl >> 32);
116 + x0[0] = (ULong)u.bits.manl;
117 +#elif defined(__i386__) || defined(__x86_64__)
118 + x0[1] = (ULong)u.bits.manh;
119 + x0[0] = (ULong)u.bits.manl;
121 +#error unsupported architecture
125 return STRTOG_NaNbits;