hash: changed to be useful for intervals too.
authorClaus Gittinger <cg@exept.de>
Tue, 10 Sep 2002 15:03:51 +0200
changeset 6749 d81bbfd885d9
parent 6748 604366d06326
child 6750 2f9d8cebba00
hash: changed to be useful for intervals too.
SequenceableCollection.st
--- a/SequenceableCollection.st	Tue Sep 10 15:03:22 2002 +0200
+++ b/SequenceableCollection.st	Tue Sep 10 15:03:51 2002 +0200
@@ -1236,12 +1236,14 @@
 
     mySize := self size.
     mySize == 0 ifTrue:[^ 0].
-    ^ (((self at:1) hash times:mySize) times:self last hash) bitAnd:16r3FFFFFFF
-
-    "
-     #(1 2 3 4 5) hash    
-     #(1 2 3 4 6) hash    
-     #(1 2 3 4 5.0) asOrderedCollection hash
+    ^ ((((self first hash bitShift:5) + self last hash) bitShift:5) + self size hash) bitAnd:16r3FFFFFFF.
+
+    "
+     #(1 2 3 4 5 6) hash     
+     (1 to:6) hash           
+
+     #(1 2 3 4 5.0) asOrderedCollection hash   
+     #(1 2 3 4 5) hash                         
     "
 
     "Modified: / 27.3.1998 / 17:33:49 / cg"
@@ -5734,6 +5736,6 @@
 !SequenceableCollection class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.169 2002-09-06 19:23:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/SequenceableCollection.st,v 1.170 2002-09-10 13:03:51 cg Exp $'
 ! !
 SequenceableCollection initialize!