Fix latest bug found by erg's random tester
parent
43cc9eafc7
commit
610c497143
|
@ -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 ;
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue