From df7b192e264fb985765c28efe4beb3ade8a6b16f Mon Sep 17 00:00:00 2001 From: "Shawn O. Pearce" Date: Wed, 9 Mar 2011 14:38:35 -0800 Subject: [PATCH] ObjectIdSubclassMap: Manually inline index() This method is trivial in definition, and is called in only 3 places. Inline the method manually to ensure its really going to be inlined by the JIT at runtime. Change-Id: I128522af8167c07d2de6cc210573599038871dda Signed-off-by: Shawn O. Pearce --- .../src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java index ee76a4280..d904eeffd 100644 --- a/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java +++ b/org.eclipse.jgit/src/org/eclipse/jgit/lib/ObjectIdSubclassMap.java @@ -92,7 +92,7 @@ public class ObjectIdSubclassMap implements Iterable { * @return the instance mapped to toFind, or null if no mapping exists. */ public V get(final AnyObjectId toFind) { - int i = index(toFind); + int i = toFind.w1 & mask; V obj; while ((obj = table[i]) != null) { @@ -155,7 +155,7 @@ public class ObjectIdSubclassMap implements Iterable { * type of instance to store. */ public V addIfAbsent(final Q newValue) { - int i = index(newValue); + int i = newValue.w1 & mask; V obj; while ((obj = table[i]) != null) { @@ -213,12 +213,8 @@ public class ObjectIdSubclassMap implements Iterable { }; } - private final int index(final AnyObjectId id) { - return id.w1 & mask; - } - private void insert(final V newValue) { - int j = index(newValue); + int j = newValue.w1 & mask; while (table[j] != null) { if (++j >= table.length) j = 0;