From bdb02562201d5df94d7b4ac4bd8623a1c825899f Mon Sep 17 00:00:00 2001 From: Matthew Flatt Date: Thu, 21 May 2020 15:35:46 -0600 Subject: [PATCH] cs: fix hash-code mixing Hashing for structures and hash tables used a very poor mixing function. --- racket/src/cs/rumble/hash-code.ss | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/racket/src/cs/rumble/hash-code.ss b/racket/src/cs/rumble/hash-code.ss index 373606e747..70e9b70355 100644 --- a/racket/src/cs/rumble/hash-code.ss +++ b/racket/src/cs/rumble/hash-code.ss @@ -179,7 +179,8 @@ [else (values (+/fx hc (eq-hash-code x)) burn)]))) (define (hash-code-combine hc v) - (bitwise-and (+ (bitwise-arithmetic-shift-left hc 2) + (bitwise-and (+ (bitwise-arithmetic-shift-left hc 10) + (bitwise-arithmetic-shift-right hc 6) v) (greatest-fixnum)))