diff -r 3fd53cc1aad8 -r e1d6aa0e4c3a mercurial/bdiff.c --- a/mercurial/bdiff.c Fri Nov 04 21:44:25 2016 -0700 +++ b/mercurial/bdiff.c Sun Nov 06 18:51:57 2016 -0800 @@ -17,6 +17,10 @@ #include "bitmanipulation.h" #include "bdiff.h" +/* Hash implementation from diffutils */ +#define ROL(v, n) ((v) << (n) | (v) >> (sizeof(v) * CHAR_BIT - (n))) +#define HASH(h, c) ((c) + ROL(h ,7)) + struct pos { int pos, len; }; @@ -44,8 +48,7 @@ /* build the line array and calculate hashes */ hash = 0; for (p = a; p < a + len; p++) { - /* Leonid Yuriev's hash */ - hash = (hash * 1664525) + (unsigned char)*p + 1013904223; + hash = HASH(hash, *p); if (*p == '\n' || p == plast) { l->hash = hash;