diff --git a/core/collections/hashtables.factor b/core/collections/hashtables.factor index 4412bf33c7..e1c262f6d9 100644 --- a/core/collections/hashtables.factor +++ b/core/collections/hashtables.factor @@ -165,11 +165,12 @@ IN: hashtables drop ; : ?grow-hash ( hash -- ) - dup hash-count 3 * over hash-array array-capacity > - [ dup grow-hash ] when drop ; inline + dup hash-count 1 fixnum+fast 3 fixnum* + over hash-array array-capacity > + [ grow-hash ] [ drop ] if ; inline : set-hash ( value key hash -- ) - [ (set-hash) ] keep ?grow-hash ; + dup ?grow-hash (set-hash) ; : hash+ ( n key hash -- ) [ hash [ 0 ] unless* + ] 2keep set-hash ; diff --git a/core/test/collections/hashtables.factor b/core/test/collections/hashtables.factor index ff2039fb51..b1816c051a 100644 --- a/core/test/collections/hashtables.factor +++ b/core/test/collections/hashtables.factor @@ -212,4 +212,5 @@ H{ } "x" set [ 1 swap set-hash ] catch drop [ 2 swap set-hash ] catch drop [ 3 swap set-hash ] catch drop + drop ] unit-test