Skip to content

Commit

Permalink
minor - make nextPowOfTwo static + cleanup unused bits
Browse files Browse the repository at this point in the history
  • Loading branch information
kares committed Oct 12, 2018
1 parent 8f13fa7 commit 1f0e600
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions core/src/main/java/org/jruby/RubyHash.java
Expand Up @@ -381,7 +381,7 @@ private final void allocFirst(final int buckets) {
}
}

private final int nextPowOfTwo(final int i) {
private static int nextPowOfTwo(final int i) {
return Integer.MIN_VALUE >>> Integer.numberOfLeadingZeros(i - 1) << 1; // i > 1
}

Expand All @@ -407,7 +407,6 @@ private final void alloc() {
public static final class RubyHashEntry implements Map.Entry {
IRubyObject key;
IRubyObject value;
private int index;
private RubyHash hash;

RubyHashEntry() {
Expand Down Expand Up @@ -476,9 +475,6 @@ private static int MRIHashValue(int h) {
}

private static final int HASH_SIGN_BIT_MASK = ~(1 << 31);
private static int MRIBucketIndex(final int h, final int length) {
return ((h & HASH_SIGN_BIT_MASK) % length);
}

private final synchronized void resize(final int newCapacity) {
final IRubyObject[] newEntries = new IRubyObject[newCapacity << 1];
Expand Down

0 comments on commit 1f0e600

Please sign in to comment.