equal
deleted
inserted
replaced
158 ] |
158 ] |
159 |
159 |
160 "Modified: 26.3.1996 / 20:00:44 / cg" |
160 "Modified: 26.3.1996 / 20:00:44 / cg" |
161 ! |
161 ! |
162 |
162 |
163 findNil:key |
|
164 "Look for the next slot usable for key. This method assumes that |
|
165 key is not already in the receiver - used only while growing/rehashing" |
|
166 |
|
167 |index "{ Class:SmallInteger }" |
|
168 length "{ Class:SmallInteger }"| |
|
169 |
|
170 length := keyArray basicSize. |
|
171 index := key identityHash. |
|
172 index < 16r1FFFFFFF ifTrue:[ |
|
173 index := index * 2 |
|
174 ]. |
|
175 index := index \\ length + 1. |
|
176 |
|
177 [(keyArray basicAt:index) notNil] whileTrue:[ |
|
178 index == length ifTrue:[ |
|
179 index := 1 |
|
180 ] ifFalse:[ |
|
181 index := index + 1 |
|
182 ]. |
|
183 "notice: no check for no nil found - we must find one since |
|
184 this is only called after growing" |
|
185 ]. |
|
186 ^ index |
|
187 ! |
|
188 |
|
189 hashFor:aKey |
163 hashFor:aKey |
190 "return an initial index given a key." |
164 "return an initial index given a key." |
191 |
165 |
192 ^ aKey identityHash |
166 ^ aKey identityHash |
193 |
167 |
220 ! ! |
194 ! ! |
221 |
195 |
222 !IdentityDictionary class methodsFor:'documentation'! |
196 !IdentityDictionary class methodsFor:'documentation'! |
223 |
197 |
224 version |
198 version |
225 ^ '$Header: /cvs/stx/stx/libbasic/IdentityDictionary.st,v 1.25 1997-03-20 15:00:06 cg Exp $' |
199 ^ '$Header: /cvs/stx/stx/libbasic/IdentityDictionary.st,v 1.26 1997-03-21 09:31:00 cg Exp $' |
226 ! ! |
200 ! ! |