[PATCH] D19731: Parse PDB Name Hash Table

David Majnemer via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 29 14:07:37 PDT 2016


majnemer added inline comments.

================
Comment at: lib/DebugInfo/PDB/Raw/NameHashTable.cpp:26
@@ +25,3 @@
+  uint32_t Result = 0;
+  uint32_t Size = Str.size();
+
----------------
Shouldn't this be a `size_t` ?

================
Comment at: lib/DebugInfo/PDB/Raw/NameHashTable.cpp:37-57
@@ +36,23 @@
+
+  // Maximum of 3 bytes left.  Hash a 2 byte word if possible, then hash the
+  // possibly remaining 1 byte.
+  if (RemainderSize >= 2) {
+    Result ^= *reinterpret_cast<const ulittle16_t *>(Remainder);
+    Remainder += 2;
+    RemainderSize -= 2;
+  }
+
+  // hash possible odd byte
+  if (RemainderSize == 1) {
+    Result ^= *(Remainder++);
+  }
+
+  const uint32_t toLowerMask = 0x20202020;
+  Result |= toLowerMask;
+  Result ^= (Result >> 11);
+
+  return Result ^ (Result >> 16);
+}
+
+static inline uint32_t HashStringV2(StringRef Str) {
+  uint32_t Hash = 0xb170a1bf;
----------------
Heh, you just addressed this right as I wrote this comment.


http://reviews.llvm.org/D19731





More information about the llvm-commits mailing list