Skip to content

Commit a6109bf

Browse files
committedJun 1, 2023
8308856: jdk.internal.classfile.impl.EntryMap::nextPowerOfTwo math problem
Reviewed-by: jlahoda
1 parent 6adc242 commit a6109bf

File tree

1 file changed

+1
-2
lines changed
  • src/java.base/share/classes/jdk/internal/classfile/impl

1 file changed

+1
-2
lines changed
 

‎src/java.base/share/classes/jdk/internal/classfile/impl/EntryMap.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ private void rehash(final int newCapacity) {
174174
}
175175

176176
public static long nextPowerOfTwo( long x ) {
177-
x = -1 >>> Long.numberOfLeadingZeros(x - 1);
178-
return x + 1;
177+
return 1L << -Long.numberOfLeadingZeros(x - 1);
179178
}
180179

181180
public static int arraySize( final int expected, final float f ) {

1 commit comments

Comments
 (1)

openjdk-notifier[bot] commented on Jun 1, 2023

@openjdk-notifier[bot]
Please sign in to comment.