another balancedtree fix
authorbrian <brian@brianweb.net>
Sat, 10 Apr 2004 00:35:25 +0000 (00:35 +0000)
committerbrian <brian@brianweb.net>
Sat, 10 Apr 2004 00:35:25 +0000 (00:35 +0000)
darcs-hash:20040410003525-24bed-7931f23e7e5375bf87b967970ae1588d2b68d441.gz

src/org/ibex/util/BalancedTree.java

index 1c42ef1..36d8542 100644 (file)
@@ -169,13 +169,14 @@ public class BalancedTree {
         // collisions when a single Object is inserted into multiple
         // trees
         int dest = Math.abs(o.hashCode() ^ this.hashCode()) % objects.length;
+        if (dest == 0) dest = 1;
         Object search = alloc ? null : o;
         int odest = dest;
         boolean plus = true;
         int tries = 1;
         while (objects[dest] != search || !(alloc || root(dest) == root)) {
-            if (dest == 0) dest++;
             dest = Math.abs((odest + (plus ? 1 : -1) * tries * tries) % objects.length);
+            if (dest == 0) dest=1;
             if (plus) tries++;
             plus = !plus;
             // FEATURE: GROW - if(tries > MAX_SLOT_DISTANCE) return -1;