cs: adapt (unused) Patricia trie implementation for negative hash codes

The hashing protocol has been adjusted since the Patricia trie
implementation so that the result can be negative. Force it to
avoid breaking an assumption in the Patricia-trie implementation
(even though this implementation is not currently used).
This commit is contained in:
Matthew Flatt 2021-04-05 11:39:17 -06:00
parent 4d23c6da5a
commit e58a3d9dda

View File

@ -258,10 +258,13 @@
[(eq? et 'eqv) (eqv? k1 k2)]
[else (key-equal? k1 k2)]))
(define-syntax-rule (to-fxpositive e)
(fxand e (most-positive-fixnum)))
(define-syntax-rule (hash-code et k)
(cond [(eq? et 'eq) (eq-hash-code k)]
[(eq? et 'eqv) (eqv-hash-code k)]
[else (key-equal-hash-code k)]))
(cond [(eq? et 'eq) (to-fxpositive (eq-hash-code k))]
[(eq? et 'eqv) (to-fxpositive (eqv-hash-code k))]
[else (to-fxpositive (key-equal-hash-code k))]))
;; iteration
(define (intmap-iterate-first t)