[llvm-commits] CVS: llvm/lib/CWriter/Writer.cpp

Chris Lattner lattner at cs.uiuc.edu
Wed Jul 23 10:23:01 PDT 2003


Changes in directory llvm/lib/CWriter:

Writer.cpp updated: 1.107 -> 1.108

---
Log message:

Simplify code by using ConstantInt::getRawValue instead of checking to see 
whether the constant is signed or unsigned, then casting


---
Diffs of the changes:

Index: llvm/lib/CWriter/Writer.cpp
diff -u llvm/lib/CWriter/Writer.cpp:1.107 llvm/lib/CWriter/Writer.cpp:1.108
--- llvm/lib/CWriter/Writer.cpp:1.107	Mon Jul 21 11:34:35 2003
+++ llvm/lib/CWriter/Writer.cpp	Wed Jul 23 10:22:15 2003
@@ -324,9 +324,7 @@
 
     // Do not include the last character, which we know is null
     for (unsigned i = 0, e = CPA->getNumOperands()-1; i != e; ++i) {
-      unsigned char C = (ETy == Type::SByteTy) ?
-        (unsigned char)cast<ConstantSInt>(CPA->getOperand(i))->getValue() :
-        (unsigned char)cast<ConstantUInt>(CPA->getOperand(i))->getValue();
+      unsigned char C = cast<ConstantInt>(CPA->getOperand(i))->getRawValue();
       
       // Print it out literally if it is a printable character.  The only thing
       // to be careful about is when the last letter output was a hex escape





More information about the llvm-commits mailing list