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:
parent
c38e0986df
commit
993db8494b
@ -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>
|
||||
|
Loading…
Reference in New Issue
Block a user