[PATCH] D49923: Support: xxHash64: Zero extend byte values loaded from the input data.

Peter Collingbourne via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Jul 27 11:14:54 PDT 2018


pcc created this revision.
pcc added a reviewer: ruiu.
Herald added a subscriber: hiraditya.

This matches the reference implementation:
https://github.com/Cyan4973/xxHash/blob/3064d42e7d74b0921bdd1818395d9cb37bb8976a/xxhash.c#L707
https://github.com/Cyan4973/xxHash/blob/3064d42e7d74b0921bdd1818395d9cb37bb8976a/xxhash.c#L147

and makes the behaviour independent of whether we are compiled with
-funsigned-char.


Repository:
  rL LLVM

https://reviews.llvm.org/D49923

Files:
  llvm/lib/Support/xxhash.cpp


Index: llvm/lib/Support/xxhash.cpp
===================================================================
--- llvm/lib/Support/xxhash.cpp
+++ llvm/lib/Support/xxhash.cpp
@@ -119,7 +119,7 @@
   }
 
   while (P < BEnd) {
-    H64 ^= (*P) * PRIME64_5;
+    H64 ^= uint8_t(*P) * PRIME64_5;
     H64 = rotl64(H64, 11) * PRIME64_1;
     P++;
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49923.157718.patch
Type: text/x-patch
Size: 338 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180727/7032db8b/attachment.bin>


More information about the llvm-commits mailing list