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