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 <spearce@spearce.org>
This commit is contained in:
parent
16350bf9e4
commit
df7b192e26
|
@ -92,7 +92,7 @@ public void clear() {
|
|||
* @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 <Q extends V> void add(final Q newValue) {
|
|||
* type of instance to store.
|
||||
*/
|
||||
public <Q extends V> 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 void remove() {
|
|||
};
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
Loading…
Reference in New Issue