aherbert commented on a change in pull request #27: Murmur3fix
URL: https://github.com/apache/commons-codec/pull/27#discussion_r341853959
 
 

 ##########
 File path: src/main/java/org/apache/commons/codec/digest/MurmurHash3.java
 ##########
 @@ -407,22 +415,25 @@ public static long hash64(final byte[] data, final int 
offset, final int length,
         * @return - 128 bit hash (2 longs)
         */
        public static long[] hash128(final byte[] data, final int offset, final 
int length, final int seed) {
-               long h1 = seed;
-               long h2 = seed;
+           // The original algorithm does have a 32 bit unsigned seed.
+           // We have to mask to match the behavior of the unsigned types and 
prevent sign extension.
+           long h1 = seed & UINT_MASK;
 
 Review comment:
   Indentation issues.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to