[llvm-commits] [SignlessTypes] CVS: llvm/lib/Bytecode/Reader/Reader.cpp
Reid Spencer
reid at x10sys.com
Thu Oct 19 16:54:28 PDT 2006
Changes in directory llvm/lib/Bytecode/Reader:
Reader.cpp updated: 1.198.2.1 -> 1.198.2.2
---
Log message:
Combine two loops that no longer need to be differentiated by type signedness.
---
Diffs of the changes: (+3 -6)
Reader.cpp | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
Index: llvm/lib/Bytecode/Reader/Reader.cpp
diff -u llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.1 llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.2
--- llvm/lib/Bytecode/Reader/Reader.cpp:1.198.2.1 Wed Oct 18 22:57:55 2006
+++ llvm/lib/Bytecode/Reader/Reader.cpp Thu Oct 19 18:54:13 2006
@@ -1700,12 +1700,9 @@
read_data(Data, Data+ATy->getNumElements());
std::vector<Constant*> Elements(ATy->getNumElements());
- if (ATy->getElementType() == Type::SByteTy)
- for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
- Elements[i] = ConstantInt::get(Type::SByteTy, (signed char)Data[i]);
- else
- for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
- Elements[i] = ConstantInt::get(Type::UByteTy, (unsigned char)Data[i]);
+ const Type* ElemType = ATy->getElementType();
+ for (unsigned i = 0, e = ATy->getNumElements(); i != e; ++i)
+ Elements[i] = ConstantInt::get(ElemType, (unsigned char)Data[i]);
// Create the constant, inserting it as needed.
Constant *C = ConstantArray::get(ATy, Elements);
More information about the llvm-commits
mailing list