In your reference C implementation you write
hash = 0x003C50DB * (*bytes++ ^ hash * 2 ^ hash / 2);
which should be equal to
hash = 0x003C50DB * (*bytes++ ^ (hash << 1) ^ (hash >> 1));
While the C compiler will probably optimize this by default, there is a number of programming languages, particularly script languages like JavaScript, where using bitwise operations instead of arithmetic ones can give a significant boost in performance.
In your reference C implementation you write
hash = 0x003C50DB * (*bytes++ ^ hash * 2 ^ hash / 2);which should be equal to
hash = 0x003C50DB * (*bytes++ ^ (hash << 1) ^ (hash >> 1));While the C compiler will probably optimize this by default, there is a number of programming languages, particularly script languages like JavaScript, where using bitwise operations instead of arithmetic ones can give a significant boost in performance.