cs: fix hash-code mixing

Hashing for structures and hash tables used a very poor mixing
function.
This commit is contained in:
Matthew Flatt 2020-05-21 15:35:46 -06:00
parent ffdfd1824d
commit bdb0256220

View File

@ -179,7 +179,8 @@
[else (values (+/fx hc (eq-hash-code x)) burn)]))) [else (values (+/fx hc (eq-hash-code x)) burn)])))
(define (hash-code-combine hc v) (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) v)
(greatest-fixnum))) (greatest-fixnum)))