diff --git a/core/hashtables/hashtables.factor b/core/hashtables/hashtables.factor index a8c8fc52cb..9da1d96ecb 100644 --- a/core/hashtables/hashtables.factor +++ b/core/hashtables/hashtables.factor @@ -187,9 +187,11 @@ M: hashtable assoc-like ! borrowed from boost::hash_combine, but the ! magic number is 2^29/phi instead of 2^32/phi ! due to max fixnum value on 32-bit machines -: hash-combine ( obj oldhash -- newhash ) - [ hashcode 0x13c6ef37 + ] dip - [ 6 shift ] [ -2 shift ] bi + + ; +: hash-combine ( hash1 hash2 -- newhash ) + [ 0x13c6ef37 + ] dip [ 6 shift ] [ -2 shift ] bi + + ; inline + +: 2hashcode ( obj1 obj2 -- hash ) + [ hashcode ] bi@ hash-combine ; inline ERROR: malformed-hashtable-pair seq pair ; diff --git a/core/words/words.factor b/core/words/words.factor index 0be414ad00..21549daa6b 100644 --- a/core/words/words.factor +++ b/core/words/words.factor @@ -188,7 +188,7 @@ M: word reset-word ] tri ; : ( name vocab -- word ) - 2dup 0 hash-combine hash-combine >fixnum (word) dup new-word ; + 2dup 2hashcode >fixnum (word) dup new-word ; : ( name -- word ) f \ counter >fixnum (word) @@ -202,8 +202,7 @@ M: word reset-word : reveal ( word -- ) dup [ name>> ] [ vocabulary>> ] bi dup vocab-words-assoc - [ ] [ no-vocab ] ?if - set-at ; + [ ] [ no-vocab ] ?if set-at ; ERROR: bad-create name vocab ;