help-smalltalk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Help-smalltalk] ObjectDumper>>example


From: Paolo Bonzini
Subject: Re: [Help-smalltalk] ObjectDumper>>example
Date: Mon, 24 Nov 2008 20:01:57 +0100
User-agent: Thunderbird 2.0.0.18 (Macintosh/20081105)

Fixed with the attached patch.

Thanks!

Paolo
diff --git a/kernel/IdentDict.st b/kernel/IdentDict.st
index d9e41ea..3e7130d 100644
--- a/kernel/IdentDict.st
+++ b/kernel/IdentDict.st
@@ -53,6 +53,24 @@ comparision message == to determine equivalence of indices.'>
        ^anObject identityHash
     ]
 
+    findElementIndex: anObject [
+        "Tries to see where anObject can be placed as an indexed variable.
+        As soon as nil is found, the index of that slot is answered.
+        anObject also comes from an indexed variable."
+
+        <category: 'private methods'>
+        | index size element |
+        self beConsistent.
+
+        "Sorry for the lack of readability, but I want speed... :-)"
+        index := (anObject identityHash scramble bitAnd: (size := self 
primSize) - 1) + 1.
+   
+        [(element := self primAt: index) isNil
+            ifTrue: [^index].
+        index == size ifTrue: [index := 1] ifFalse: [index := index + 1]]
+                repeat
+    ]
+
     findIndex: anObject [
        "Tries to see if anObject exists as an indexed variable. As soon as nil
         or anObject is found, the index of that slot is answered"

reply via email to

[Prev in Thread] Current Thread [Next in Thread]