Skip to content

Commit

Permalink
Fix insertion into collision nodes
Browse files Browse the repository at this point in the history
- use equal? for comparing hashes
- chash is the hash, not collision-hash
- return a collision node, not an alist
  • Loading branch information
ijp committed Jul 7, 2014
1 parent e31aad0 commit 4fc0b53
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions hamts.sls
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,9 @@

(define (handle-collision node hash level)
(define chash (bitwise-arithmetic-shift-right (collision-hash node) level))
(if (eqv? hash collision-hash)
(alist-set (collision-alist node) key value eqv?)
(if (equal? hash chash)
(make-collision (collision-hash node)
(alist-set (collision-alist node) key value eqv?))
;; TODO: there may be a better (more efficient) way to do this
;; but simple is better for now (see also handle-leaf)
(handle-subtrie (wrap-subtrie node chash) hash (level-up level))))
Expand Down

0 comments on commit 4fc0b53

Please sign in to comment.