vlsi commented on a change in pull request #601:
URL: https://github.com/apache/jmeter/pull/601#discussion_r445094818



##########
File path: src/core/src/main/java/org/apache/jmeter/util/JMeterUtils.java
##########
@@ -1311,4 +1312,16 @@ public static final XStream createXStream() {
         JMeterUtils.setupXStreamSecurityPolicy(xstream);
         return xstream;
     }
+
+    /**
+     * Calculate the next power of 2, greater than or equal to x.
+     * <p>
+     * From Hacker's Delight, Chapter 3, Harry S. Warren Jr.
+     *
+     * @param x Value to round up
+     * @return The next power of 2 from x inclusive
+     */
+    public static int ceilingNextPowerOfTwo(final int x) {
+        return 1 << (BITS_PER_INT - Integer.numberOfLeadingZeros(x - 1));

Review comment:
       I'm not sure this should be in public api, but please use 
`java.lang.Integer#SIZE` instead of `BITS_PER_INT`




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to