[PATCH] D45571: [ELF] - Speedup MergeInputSection::splitStrings

Rafael Avila de Espindola via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 24 11:08:08 PDT 2018


espindola added inline comments.


================
Comment at: ELF/InputSection.cpp:886
+  while (DataSize > sizeof(uint32_t)) {
+    uint32_t Word = *reinterpret_cast<const uint32_t *>(Data);
+    // This checks if at least one byte of a word is a null byte.
----------------
This will produce different results on a big endian host, no?


================
Comment at: ELF/InputSection.cpp:894
+    DataSize -= sizeof(uint32_t);
+    Hash = (Hash << 5) + Hash + Word;
+  }
----------------
I don't know enough about hashing to judge if this is a reasonable extension of the djb hash for using 4 bytes at a time, but we can probably start with it.


https://reviews.llvm.org/D45571





More information about the llvm-commits mailing list