Fix latest bug found by erg's random tester

slava 2006-12-13 08:42:34 +00:00
parent 43cc9eafc7
commit 610c497143
2 changed files with 5 additions and 3 deletions

View File

@ -165,11 +165,12 @@ IN: hashtables
drop ; drop ;
: ?grow-hash ( hash -- ) : ?grow-hash ( hash -- )
dup hash-count 3 * over hash-array array-capacity > dup hash-count 1 fixnum+fast 3 fixnum*
[ dup grow-hash ] when drop ; inline over hash-array array-capacity >
[ grow-hash ] [ drop ] if ; inline
: set-hash ( value key hash -- ) : set-hash ( value key hash -- )
[ (set-hash) ] keep ?grow-hash ; dup ?grow-hash (set-hash) ;
: hash+ ( n key hash -- ) : hash+ ( n key hash -- )
[ hash [ 0 ] unless* + ] 2keep set-hash ; [ hash [ 0 ] unless* + ] 2keep set-hash ;

View File

@ -212,4 +212,5 @@ H{ } "x" set
[ 1 swap set-hash ] catch drop [ 1 swap set-hash ] catch drop
[ 2 swap set-hash ] catch drop [ 2 swap set-hash ] catch drop
[ 3 swap set-hash ] catch drop [ 3 swap set-hash ] catch drop
drop
] unit-test ] unit-test