diff options
author | das <das@FreeBSD.org> | 2011-03-12 07:03:06 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2011-03-12 07:03:06 +0000 |
commit | 22b42559b254072c025ee7660742d9096d6ddbfd (patch) | |
tree | 02fea95a802135fbb5d2f67a8c005bf132b6e256 /contrib/gdtoa/gethex.c | |
parent | bb4fe3b8f6c28c422e237503dec22ccea5269dba (diff) | |
parent | a0113107f8ebf649eb6c0730ece07fe0865a384b (diff) | |
download | FreeBSD-src-22b42559b254072c025ee7660742d9096d6ddbfd.zip FreeBSD-src-22b42559b254072c025ee7660742d9096d6ddbfd.tar.gz |
Merge gdtoa-20110304.
Diffstat (limited to 'contrib/gdtoa/gethex.c')
-rw-r--r-- | contrib/gdtoa/gethex.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/contrib/gdtoa/gethex.c b/contrib/gdtoa/gethex.c index c8ac8ba..a9982c9 100644 --- a/contrib/gdtoa/gethex.c +++ b/contrib/gdtoa/gethex.c @@ -57,7 +57,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) static unsigned char *decimalpoint_cache; if (!(s0 = decimalpoint_cache)) { s0 = (unsigned char*)localeconv()->decimal_point; - if ((decimalpoint_cache = (char*)malloc(strlen(s0) + 1))) { + if ((decimalpoint_cache = (char*)MALLOC(strlen(s0) + 1))) { strcpy(decimalpoint_cache, s0); s0 = decimalpoint_cache; } @@ -199,7 +199,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) return STRTOG_Normal | STRTOG_Inexlo; } n = s1 - s0 - 1; - for(k = 0; n > (1 << kshift-2) - 1; n >>= 1) + for(k = 0; n > (1 << (kshift-2)) - 1; n >>= 1) k++; b = Balloc(k); x = b->x; @@ -314,7 +314,7 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) break; case FPI_Round_near: if (lostbits & 2 - && (lostbits & 1) | x[0] & 1) + && (lostbits | x[0]) & 1) up = 1; break; case FPI_Round_up: @@ -333,8 +333,8 @@ gethex( CONST char **sp, FPI *fpi, Long *exp, Bigint **bp, int sign) irv = STRTOG_Normal; } else if (b->wds > k - || (n = nbits & kmask) !=0 - && hi0bits(x[k-1]) < 32-n) { + || ((n = nbits & kmask) !=0 + && hi0bits(x[k-1]) < 32-n)) { rshift(b,1); if (++e > fpi->emax) goto ovfl; |