Sequence hashcode

db4
Daniel Ehrenberg 2007-12-17 00:42:41 -05:00
parent c0d2654618
commit cd86eb8feb
1 changed files with 7 additions and 3 deletions

View File

@ -674,9 +674,13 @@ PRIVATE>
! hashcode* >fixnum swap 31 fixnum*fast fixnum+fast
! ] curry* each ; inline
: sequence-hashcode-step ( oldhash newpart -- newhash )
swap [
dup -2 shift swap 5 shift
fixnum+fast fixnum+fast
] keep bitxor ;
: sequence-hashcode ( n seq -- x )
0 -rot [
hashcode* >fixnum swap
[ -2 shift fixnum+fast ] keep [ 5 shift fixnum+fast ] keep
bitxor
hashcode* >fixnum sequence-hashcode-step
] curry* each ; inline