layouts: speed up ``M\ iota hashcode*`` using most-positive-fixnum.
parent
be7c981462
commit
668d37fef7
|
@ -201,8 +201,6 @@ M: reversed hashcode* [ sequence-hashcode ] recursive-hashcode ;
|
|||
|
||||
M: slice hashcode* [ sequence-hashcode ] recursive-hashcode ;
|
||||
|
||||
M: iota hashcode* over 0 <= [ 2drop 0 ] [ sequence-hashcode ] if ;
|
||||
|
||||
M: hashtable hashcode*
|
||||
[
|
||||
dup assoc-size 1 eq?
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
! Copyright (C) 2007, 2009 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: namespaces math words kernel assocs classes
|
||||
math.order kernel.private ;
|
||||
math.order kernel.private sequences sequences.private ;
|
||||
IN: layouts
|
||||
|
||||
SYMBOL: data-alignment
|
||||
|
@ -91,4 +91,17 @@ M: real >integer
|
|||
dup most-negative-fixnum most-positive-fixnum between?
|
||||
[ >fixnum ] [ >bignum ] if ; inline
|
||||
|
||||
! we put this here so that it can use the references to
|
||||
! most-positive-fixnum otherwise would be in combinatrs
|
||||
M: iota hashcode*
|
||||
over 0 <= [ 2drop 0 ] [
|
||||
nip length [
|
||||
0 most-positive-fixnum clamp integer>fixnum
|
||||
0 swap [ sequence-hashcode-step ] each-integer
|
||||
] [
|
||||
most-positive-fixnum swap
|
||||
[ sequence-hashcode-step ] (each-integer)
|
||||
] bi
|
||||
] if ;
|
||||
|
||||
UNION: immediate fixnum POSTPONE: f ;
|
||||
|
|
Loading…
Reference in New Issue