Jes Cok created FLINK-33725:
-------------------------------

             Summary: MathUtils.isPowerOf2  does not cover the case of value=0
                 Key: FLINK-33725
                 URL: https://issues.apache.org/jira/browse/FLINK-33725
             Project: Flink
          Issue Type: Improvement
          Components: API / Core
            Reporter: Jes Cok


org.apache.flink.util.MathUtils.isPowerOf2, 
 
This static method does not cover the case of value=0.
Should the document explain that value cannot be =0?
Or could it be re implemented as the following code?
 
public static boolean isPowerOf2(long value) {
  return value > 0 && (value & (value - 1)) == 0;
}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to