diff options
author | David Schultz <das@FreeBSD.org> | 2007-12-16 23:31:55 +0000 |
---|---|---|
committer | David Schultz <das@FreeBSD.org> | 2007-12-16 23:31:55 +0000 |
commit | fb048cca0c021e5f7edb58147f3c7888d9be801f (patch) | |
tree | 2da2e0068c9485c3241476f588851c96f14d8b3b /contrib/gdtoa | |
parent | 3d6d3ed091441cddcca7d6be6afe95715ec2dfc7 (diff) | |
download | src-fb048cca0c021e5f7edb58147f3c7888d9be801f.tar.gz src-fb048cca0c021e5f7edb58147f3c7888d9be801f.zip |
Fix previous commit: We should only mask the top bit in the STRTOG_NaNBits
case, not the STRTOG_Normal case.
Notes
Notes:
svn path=/head/; revision=174690
Diffstat (limited to 'contrib/gdtoa')
-rw-r--r-- | contrib/gdtoa/strtorQ.c | 6 | ||||
-rw-r--r-- | contrib/gdtoa/strtorx.c | 9 |
2 files changed, 14 insertions, 1 deletions
diff --git a/contrib/gdtoa/strtorQ.c b/contrib/gdtoa/strtorQ.c index b7f9bba430da..bd183bc2ac69 100644 --- a/contrib/gdtoa/strtorQ.c +++ b/contrib/gdtoa/strtorQ.c @@ -65,6 +65,12 @@ ULtoQ(ULong *L, ULong *bits, Long exp, int k) break; case STRTOG_Normal: + L[_3] = bits[0]; + L[_2] = bits[1]; + L[_1] = bits[2]; + L[_0] = (bits[3] & ~0x10000) | ((exp + 0x3fff + 112) << 16); + break; + case STRTOG_NaNbits: L[_3] = bits[0]; L[_2] = bits[1]; diff --git a/contrib/gdtoa/strtorx.c b/contrib/gdtoa/strtorx.c index 52d7eff586fa..e9fd45f1fbe4 100644 --- a/contrib/gdtoa/strtorx.c +++ b/contrib/gdtoa/strtorx.c @@ -71,12 +71,19 @@ ULtox(UShort *L, ULong *bits, Long exp, int k) goto normal_bits; case STRTOG_Normal: - case STRTOG_NaNbits: L[_0] = exp + 0x3fff + 63; normal_bits: L[_4] = (UShort)bits[0]; L[_3] = (UShort)(bits[0] >> 16); L[_2] = (UShort)bits[1]; + L[_1] = (UShort)(bits[1] >> 16); + break; + + case STRTOG_NaNbits: + L[_0] = exp + 0x3fff + 63; + L[_4] = (UShort)bits[0]; + L[_3] = (UShort)(bits[0] >> 16); + L[_2] = (UShort)bits[1]; L[_1] = (UShort)((bits[1] >> 16) | (3 << 14)); break; |