]> gitweb.factorcode.org Git - factor.git/commitdiff
Fix latest bug found by erg's random tester
authorslava <slava@factorcode.org>
Wed, 13 Dec 2006 08:42:34 +0000 (08:42 +0000)
committerslava <slava@factorcode.org>
Wed, 13 Dec 2006 08:42:34 +0000 (08:42 +0000)
core/collections/hashtables.factor
core/test/collections/hashtables.factor

index 4412bf33c791eaa7ad62be3fa4a45cc330a10908..e1c262f6d9d3f401f937be1ef56f506b4ba749f3 100644 (file)
@@ -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 ;
index ff2039fb5182e8bcbb19e518e7e5f36a5b3db406..b1816c051a3a6d6b3d065ae5d05ac5438689805d 100644 (file)
@@ -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