[llvm-commits] [llvm] r111846 - /llvm/trunk/lib/MC/ELFObjectWriter.cpp
Benjamin Kramer
benny.kra at googlemail.com
Mon Aug 23 14:23:52 PDT 2010
Author: d0k
Date: Mon Aug 23 16:23:52 2010
New Revision: 111846
URL: http://llvm.org/viewvc/llvm-project?rev=111846&view=rev
Log:
Reduce code duplication.
Modified:
llvm/trunk/lib/MC/ELFObjectWriter.cpp
Modified: llvm/trunk/lib/MC/ELFObjectWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/ELFObjectWriter.cpp?rev=111846&r1=111845&r2=111846&view=diff
==============================================================================
--- llvm/trunk/lib/MC/ELFObjectWriter.cpp (original)
+++ llvm/trunk/lib/MC/ELFObjectWriter.cpp Mon Aug 23 16:23:52 2010
@@ -64,8 +64,8 @@
// Support lexicographic sorting.
bool operator<(const ELFSymbolData &RHS) const {
- const std::string &Name = SymbolData->getSymbol().getName();
- return Name < RHS.SymbolData->getSymbol().getName();
+ return SymbolData->getSymbol().getName() <
+ RHS.SymbolData->getSymbol().getName();
}
};
@@ -151,21 +151,13 @@
}
void StringLE32(char *buf, uint32_t Value) {
- buf[0] = char(Value >> 0);
- buf[1] = char(Value >> 8);
- buf[2] = char(Value >> 16);
- buf[3] = char(Value >> 24);
+ StringLE16(buf, uint16_t(Value >> 0));
+ StringLE16(buf, uint16_t(Value >> 16));
}
void StringLE64(char *buf, uint64_t Value) {
- buf[0] = char(Value >> 0);
- buf[1] = char(Value >> 8);
- buf[2] = char(Value >> 16);
- buf[3] = char(Value >> 24);
- buf[4] = char(Value >> 32);
- buf[5] = char(Value >> 40);
- buf[6] = char(Value >> 48);
- buf[7] = char(Value >> 56);
+ StringLE32(buf, uint32_t(Value >> 0));
+ StringLE32(buf, uint32_t(Value >> 32));
}
void StringBE16(char *buf ,uint16_t Value) {
@@ -174,21 +166,13 @@
}
void StringBE32(char *buf, uint32_t Value) {
- buf[0] = char(Value >> 24);
- buf[1] = char(Value >> 16);
- buf[2] = char(Value >> 8);
- buf[3] = char(Value >> 0);
+ StringBE16(buf, uint16_t(Value >> 16));
+ StringBE16(buf, uint16_t(Value >> 0));
}
void StringBE64(char *buf, uint64_t Value) {
- buf[0] = char(Value >> 56);
- buf[1] = char(Value >> 48);
- buf[2] = char(Value >> 40);
- buf[3] = char(Value >> 32);
- buf[4] = char(Value >> 24);
- buf[5] = char(Value >> 16);
- buf[6] = char(Value >> 8);
- buf[7] = char(Value >> 0);
+ StringBE32(buf, uint32_t(Value >> 32));
+ StringBE32(buf, uint32_t(Value >> 0));
}
void String16(char *buf, uint16_t Value) {
More information about the llvm-commits
mailing list