--- a/Set.st Fri Nov 29 12:08:54 2002 +0100
+++ b/Set.st Fri Nov 29 12:10:04 2002 +0100
@@ -613,12 +613,7 @@
"/ ^ keyArray indexOf:key ifAbsent:aBlock
"/ ].
- index := key hash.
- index < 16r1FFFFFFF ifTrue:[
- index := index * 2
- ].
- index := index \\ length + 1.
- startIndex := index.
+ startIndex := index := self initialIndexForKey:key.
[true] whileTrue:[
probe := (keyArray basicAt:index).
@@ -642,29 +637,22 @@
|index "{ Class:SmallInteger }"
length "{ Class:SmallInteger }"
startIndex probe
- delIndex "{ Class:SmallInteger }" |
-
- delIndex := 0.
+ delIndex|
length := keyArray basicSize.
- index := key hash.
- index < 16r1FFFFFFF ifTrue:[
- index := index * 2
- ].
- index := index \\ length + 1.
- startIndex := index.
+ startIndex := index := self initialIndexForKey:key.
[true] whileTrue:[
probe := keyArray basicAt:index.
key = probe ifTrue:[^ index].
(self slotIsEmpty:probe) ifTrue:[
- delIndex == 0 ifTrue:[^ index].
+ delIndex isNil ifTrue:[^ index].
keyArray basicAt:delIndex put:nil.
^ delIndex
].
probe == DeletedEntry ifTrue:[
- delIndex == 0 ifTrue:[
+ delIndex isNil ifTrue:[
delIndex := index
]
].
@@ -675,7 +663,7 @@
index := index + 1
].
index == startIndex ifTrue:[
- delIndex ~~ 0 ifTrue:[
+ delIndex notNil ifTrue:[
keyArray basicAt:delIndex put:nil.
^ delIndex
].
@@ -700,11 +688,7 @@
length "{ Class:SmallInteger }"|
length := keyArray basicSize.
- index := self hashFor:key.
- index < 16r1FFFFFFF ifTrue:[
- index := index * 2
- ].
- index := index \\ length + 1.
+ index := self initialIndexForKey:key.
"/ index := keyArray identityIndexOf:nil startingAt:index.
"/ index == 0 ifTrue:[
@@ -739,9 +723,9 @@
to redefine it. (which may be a bad design decision, but slightly
improves performance, by avoiding an extra message send ...)"
- |index|
+ |index "{ Class:SmallInteger }"|
- index := hashKey.
+ index := hashKey bitAnd:16r3FFFFFFF.
index < 16r1FFFFFFF ifTrue:[
index := index * 2
].
@@ -758,7 +742,7 @@
length "{ Class:SmallInteger }"|
length := keyArray basicSize.
- index := self hashFor:aKey.
+ index := (self hashFor:aKey) bitAnd:16r3FFFFFFF.
index < 16r1FFFFFFF ifTrue:[
index := index * 2
].
@@ -1137,6 +1121,7 @@
!Set class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.78 2002-06-13 14:02:39 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/Set.st,v 1.79 2002-11-29 11:10:04 cg Exp $'
! !
+
Set initialize!