aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Johannesen <dalej@apple.com>2007-09-30 18:17:01 +0000
committerDale Johannesen <dalej@apple.com>2007-09-30 18:17:01 +0000
commite96fcea579a91a8b06fce5bd9be3054830dc5be5 (patch)
treea425b19e7c2c5142d1c043911ba80cf82670cf7c
parent76e4b61dfd89698438a8b654194eb11b719dcc36 (diff)
downloadexternal_llvm-e96fcea579a91a8b06fce5bd9be3054830dc5be5.zip
external_llvm-e96fcea579a91a8b06fce5bd9be3054830dc5be5.tar.gz
external_llvm-e96fcea579a91a8b06fce5bd9be3054830dc5be5.tar.bz2
Simplify and fix signed int -> FP conversions.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@42483 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Support/APFloat.cpp14
1 files changed, 3 insertions, 11 deletions
diff --git a/lib/Support/APFloat.cpp b/lib/Support/APFloat.cpp
index 278e546..8e1580b 100644
--- a/lib/Support/APFloat.cpp
+++ b/lib/Support/APFloat.cpp
@@ -1519,17 +1519,9 @@ APFloat::convertFromInteger(const integerPart *parts, unsigned int width,
integerPart *copy = new integerPart[partCount];
sign = false;
- if(isSigned) {
- if (APInt::tcExtractBit(parts, width - 1)) {
- sign = true;
- if (width < partCount * integerPartWidth)
- api = api.sext(partCount * integerPartWidth);
- }
- else if (width < partCount * integerPartWidth)
- api = api.zext(partCount * integerPartWidth);
- } else {
- if (width < partCount * integerPartWidth)
- api = api.zext(partCount * integerPartWidth);
+ if(isSigned && APInt::tcExtractBit(parts, width - 1)) {
+ sign = true;
+ api = -api;
}
APInt::tcAssign(copy, api.getRawData(), partCount);