diff options
author | Neil Booth <neil@daikokuya.co.uk> | 2007-10-07 11:45:55 +0000 |
---|---|---|
committer | Neil Booth <neil@daikokuya.co.uk> | 2007-10-07 11:45:55 +0000 |
commit | 5f00973393f24c093c5631b3a662cca54f777e49 (patch) | |
tree | 23358596dcd3b0a1dff45ad642f1dc9a43de2616 /llvm/lib/Support/APFloat.cpp | |
parent | c330d008f48a3a7a396743f4cf4bdebbdafa8ba7 (diff) | |
download | bcm5719-llvm-5f00973393f24c093c5631b3a662cca54f777e49.tar.gz bcm5719-llvm-5f00973393f24c093c5631b3a662cca54f777e49.zip |
convertFromInteger, as originally written, expected sign-extended
input. APInt unfortunately zero-extends signed integers, so Dale
modified the function to expect zero-extended input. Make this
assumption explicit in the function name.
llvm-svn: 42732
Diffstat (limited to 'llvm/lib/Support/APFloat.cpp')
-rw-r--r-- | llvm/lib/Support/APFloat.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 2037210e05b..5e3504b19a5 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/lib/Support/APFloat.cpp @@ -1247,8 +1247,8 @@ APFloat::mod(const APFloat &rhs, roundingMode rounding_mode) if (fs==opInvalidOp) return fs; - fs = V.convertFromInteger(x, parts * integerPartWidth, true, - rmNearestTiesToEven); + fs = V.convertFromZeroExtendedInteger(x, parts * integerPartWidth, true, + rmNearestTiesToEven); assert(fs==opOK); // should always work fs = V.multiply(rhs, rounding_mode); @@ -1576,9 +1576,11 @@ APFloat::convertFromUnsignedInteger(integerPart *parts, return normalize(rounding_mode, lost_fraction); } +/* FIXME: should this just take a const APInt reference? */ APFloat::opStatus -APFloat::convertFromInteger(const integerPart *parts, unsigned int width, - bool isSigned, roundingMode rounding_mode) +APFloat::convertFromZeroExtendedInteger(const integerPart *parts, + unsigned int width, bool isSigned, + roundingMode rounding_mode) { unsigned int partCount = partCountForBits(width); opStatus status; |