diff options
| author | Dale Johannesen <dalej@apple.com> | 2007-09-30 18:17:01 +0000 |
|---|---|---|
| committer | Dale Johannesen <dalej@apple.com> | 2007-09-30 18:17:01 +0000 |
| commit | 28a2c4a9c4ccfe872e450d7dd99255336e73ee30 (patch) | |
| tree | 5268b2fdaad3c1007cd40a7cc16c893c8d423d59 | |
| parent | 0b7cf862bcb2c02b22440d9bfa0deaef592ee061 (diff) | |
| download | bcm5719-llvm-28a2c4a9c4ccfe872e450d7dd99255336e73ee30.tar.gz bcm5719-llvm-28a2c4a9c4ccfe872e450d7dd99255336e73ee30.zip | |
Simplify and fix signed int -> FP conversions.
llvm-svn: 42483
| -rw-r--r-- | llvm/lib/Support/APFloat.cpp | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/llvm/lib/Support/APFloat.cpp b/llvm/lib/Support/APFloat.cpp index 278e546d8a3..8e1580bd4a7 100644 --- a/llvm/lib/Support/APFloat.cpp +++ b/llvm/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); |

