Skip to content

Commit

Permalink
MathUtil.findNextPositivePowerOfTwo instead of JCTools' (#13833)
Browse files Browse the repository at this point in the history
Motivation:

Less dependency on an external library

Modifications:

Use our own implementation


Result:

Code cleanup
  • Loading branch information
lucamolteni committed Feb 9, 2024
1 parent 59a8bd0 commit 9f19909
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common/src/main/java/io/netty/util/HashedWheelTimer.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@
import static io.netty.util.internal.ObjectUtil.checkNotNull;

import io.netty.util.concurrent.ImmediateExecutor;
import io.netty.util.internal.MathUtil;
import io.netty.util.internal.PlatformDependent;
import io.netty.util.internal.logging.InternalLogger;
import io.netty.util.internal.logging.InternalLoggerFactory;
import org.jctools.util.Pow2;

import java.util.Collections;
import java.util.HashSet;
Expand Down Expand Up @@ -334,7 +334,7 @@ protected void finalize() throws Throwable {
}

private static HashedWheelBucket[] createWheel(int ticksPerWheel) {
ticksPerWheel = Pow2.roundToPowerOfTwo(ticksPerWheel);
ticksPerWheel = MathUtil.findNextPositivePowerOfTwo(ticksPerWheel);

HashedWheelBucket[] wheel = new HashedWheelBucket[ticksPerWheel];
for (int i = 0; i < wheel.length; i ++) {
Expand Down

0 comments on commit 9f19909

Please sign in to comment.