Fixed parsing of hex floats.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@122963 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Abramo Bagnara 2011-01-06 16:55:14 +00:00
parent 2f867a63da
commit 4bb46f43eb

View File

@ -194,11 +194,11 @@ totalExponent(StringRef::iterator p, StringRef::iterator end,
assert(value < 10U && "Invalid character in exponent"); assert(value < 10U && "Invalid character in exponent");
unsignedExponent = unsignedExponent * 10 + value; unsignedExponent = unsignedExponent * 10 + value;
if (unsignedExponent > 65535) if (unsignedExponent > 32767)
overflow = true; overflow = true;
} }
if (exponentAdjustment > 65535 || exponentAdjustment < -65536) if (exponentAdjustment > 32767 || exponentAdjustment < -32768)
overflow = true; overflow = true;
if (!overflow) { if (!overflow) {
@ -206,12 +206,12 @@ totalExponent(StringRef::iterator p, StringRef::iterator end,
if (negative) if (negative)
exponent = -exponent; exponent = -exponent;
exponent += exponentAdjustment; exponent += exponentAdjustment;
if (exponent > 65535 || exponent < -65536) if (exponent > 32767 || exponent < -32768)
overflow = true; overflow = true;
} }
if (overflow) if (overflow)
exponent = negative ? -65536: 65535; exponent = negative ? -32768: 32767;
return exponent; return exponent;
} }