1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 11:13:28 +01:00

Simplify getSection. NFC.

llvm-svn: 285803
This commit is contained in:
Rafael Espindola 2016-11-02 12:49:55 +00:00
parent c38e0986df
commit 993db8494b

View File

@ -415,11 +415,10 @@ ELFFile<ELFT>::getSection(uint32_t Index) const {
if (Index >= getNumSections())
return object_error::invalid_section_index;
const uint8_t *Addr = reinterpret_cast<const uint8_t *>(SectionHeaderTable) +
(Index * Header->e_shentsize);
if (Addr >= base() + getBufSize())
const Elf_Shdr *Addr = SectionHeaderTable + Index;
if (reinterpret_cast<const uint8_t *>(Addr) >= base() + getBufSize())
return object_error::invalid_section_index;
return reinterpret_cast<const Elf_Shdr *>(Addr);
return Addr;
}
template <class ELFT>