diff --git a/core/hash-sets/hash-sets-tests.factor b/core/hash-sets/hash-sets-tests.factor index 46dc06849f..3bf7f8a454 100644 --- a/core/hash-sets/hash-sets-tests.factor +++ b/core/hash-sets/hash-sets-tests.factor @@ -1,7 +1,17 @@ ! Copyright (C) 2010 Daniel Ehrenberg ! See http://factorcode.org/license.txt for BSD license. -USING: accessors fry hash-sets kernel math prettyprint sequences -sets sorting tools.test ; +USING: accessors arrays fry hash-sets hash-sets.private kernel math +prettyprint sequences sets sorting tools.test ; +FROM: hashtables.private => tombstone ; + +! key@ +{ + { { T{ tombstone } T{ tombstone } } f f } + { { T{ tombstone } 123 } 1 t } +} [ + "hi" 0 key@ 3array + 123 HS{ 123 } key@ 3array +] unit-test { { 1 2 3 } } [ HS{ 1 2 3 } members natural-sort ] unit-test diff --git a/core/hash-sets/hash-sets.factor b/core/hash-sets/hash-sets.factor index 9e99dc6a1a..03577db12a 100644 --- a/core/hash-sets/hash-sets.factor +++ b/core/hash-sets/hash-sets.factor @@ -32,8 +32,7 @@ TUPLE: hash-set ] if ; inline recursive : key@ ( key hash -- array n ? ) - array>> dup length>> 0 eq? - [ no-key ] [ 2dup hash@ 0 (key@) ] if ; inline + array>> 2dup hash@ 0 (key@) ; inline : ( n -- array ) 3 * 1 + 2/ next-power-of-2 +empty+ ; inline diff --git a/core/hashtables/hashtables.factor b/core/hashtables/hashtables.factor index d7763428d7..ee14103cb8 100644 --- a/core/hashtables/hashtables.factor +++ b/core/hashtables/hashtables.factor @@ -32,8 +32,7 @@ TUPLE: hashtable ] if ; inline recursive : key@ ( key hash -- array n ? ) - array>> dup length>> 0 eq? - [ no-key ] [ 2dup hash@ 0 (key@) ] if ; inline + array>> 2dup hash@ 0 (key@) ; inline : ( n -- array ) 3 * 1 + 2/ next-power-of-2 2 * +empty+ ; inline