[ELF] Optimize MergeInputSection::splitNonStrings. NFC

This commit is contained in:
Fangrui Song 2021-12-16 21:22:59 -08:00
parent 4c98d08841
commit 054cdb34a2
1 changed files with 3 additions and 2 deletions

View File

@ -1388,8 +1388,9 @@ void MergeInputSection::splitNonStrings(ArrayRef<uint8_t> data,
assert((size % entSize) == 0);
const bool live = !(flags & SHF_ALLOC) || !config->gcSections;
for (size_t i = 0; i != size; i += entSize)
pieces.emplace_back(i, xxHash64(data.slice(i, entSize)), live);
pieces.assign(size / entSize, SectionPiece(0, 0, false));
for (size_t i = 0, j = 0; i != size; i += entSize, j++)
pieces[j] = {i, (uint32_t)xxHash64(data.slice(i, entSize)), live};
}
template <class ELFT>