You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by le...@apache.org on 2022/05/21 00:37:39 UTC

[datasketches-java] 01/01: Minor method renaming that propogated to a lot of places.

This is an automated email from the ASF dual-hosted git repository.

leerho pushed a commit to branch Minor_cleanups
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git

commit 4db2da1da252d79322757001ed2638fed4c1571a
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Fri May 20 17:37:22 2022 -0700

    Minor method renaming that propogated to a lot of places.
---
 .github/workflows/codeql-analysis.yml              | 69 ----------------------
 src/main/java/org/apache/datasketches/Util.java    | 29 ++++-----
 .../datasketches/frequencies/ItemsSketch.java      |  4 +-
 .../datasketches/frequencies/LongsSketch.java      |  4 +-
 .../frequencies/ReversePurgeItemHashMap.java       |  4 +-
 .../frequencies/ReversePurgeLongHashMap.java       |  4 +-
 .../org/apache/datasketches/hll/PreambleUtil.java  |  6 +-
 .../sampling/ReservoirItemsSketch.java             |  8 +--
 .../sampling/ReservoirLongsSketch.java             |  8 +--
 .../datasketches/sampling/ReservoirSize.java       |  2 +-
 .../datasketches/sampling/VarOptItemsSketch.java   |  8 +--
 .../org/apache/datasketches/theta/AnotBimpl.java   |  4 +-
 .../java/org/apache/datasketches/tuple/AnotB.java  |  6 +-
 .../datasketches/tuple/QuickSelectSketch.java      |  4 +-
 .../arrayofdoubles/ArrayOfDoublesAnotBImpl.java    |  4 +-
 .../HeapArrayOfDoublesQuickSelectSketch.java       |  4 +-
 .../java/org/apache/datasketches/UtilTest.java     | 10 ++--
 17 files changed, 53 insertions(+), 125 deletions(-)

diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml
deleted file mode 100644
index 9beda7d6..00000000
--- a/.github/workflows/codeql-analysis.yml
+++ /dev/null
@@ -1,69 +0,0 @@
-# For most projects, this workflow file will not need changing; you simply need
-# to commit it to your repository.
-#
-# You may wish to alter this file to override the set of languages analyzed,
-# or to provide custom queries or build logic.
-#
-# ******** NOTE ********
-# We have attempted to detect the languages in your repository. Please check
-# the `language` matrix defined below to confirm you have the correct set of
-# supported CodeQL languages.
-#
-name: "CodeQL"
-
-on:
-  push:
-    branches: [ master ]
-  pull_request:
-    # The branches below must be a subset of the branches above
-    branches: [ master ]
-  workflow_dispatch:
-
-jobs:
-  analyze:
-    name: Analyze
-    runs-on: ubuntu-latest
-    permissions:
-      actions: read
-      contents: read
-      security-events: write
-
-    strategy:
-      fail-fast: false
-      matrix:
-        language: [ 'java' ]
-        # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
-        # Learn more about CodeQL language support at https://git.io/codeql-language-support
-
-    steps:
-    - name: Checkout repository
-      uses: actions/checkout@v3
-
-    # Initializes the CodeQL tools for scanning.
-    - name: Initialize CodeQL
-      uses: github/codeql-action/init@v2
-      with:
-        languages: ${{ matrix.language }}
-        # If you wish to specify custom queries, you can do so here or in a config file.
-        # By default, queries listed here will override any specified in a config file.
-        # Prefix the list here with "+" to use these queries and those in the config file.
-        # queries: ./path/to/local/query, your-org/your-repo/queries@main
-
-    # Autobuild attempts to build any compiled languages  (C/C++, C#, or Java).
-    # If this step fails, then you should remove it and run the build manually (see below)
-    - name: Autobuild
-      uses: github/codeql-action/autobuild@v2
-
-    # â„šī¸ Command-line programs to run using the OS shell.
-    # 📚 https://git.io/JvXDl
-
-    # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines
-    #    and modify them (or add more) to build your code if your project
-    #    uses a compiled language
-
-    #- run: |
-    #   make bootstrap
-    #   make release
-
-    - name: Perform CodeQL Analysis
-      uses: github/codeql-action/analyze@v2
diff --git a/src/main/java/org/apache/datasketches/Util.java b/src/main/java/org/apache/datasketches/Util.java
index f4b6c47e..eeec1054 100644
--- a/src/main/java/org/apache/datasketches/Util.java
+++ b/src/main/java/org/apache/datasketches/Util.java
@@ -421,41 +421,38 @@ public final class Util {
    * Checks the given parameter to make sure it is positive, an integer-power of 2 and greater than
    * zero.
    *
-   * @param v The input argument.
+   * @param powerOf2 The input argument must be a power of 2 and greater than zero.
    * @param argName Used in the thrown exception.
    */
-  public static void checkIfPowerOf2(final int v, final String argName) {
-    if (v > 0 && (v & v - 1) == 0) {
-      return;
-    }
+  public static void checkIfPowerOf2(final int powerOf2, final String argName) {
+    if (powerOf2 > 0 && (powerOf2 & powerOf2 - 1) == 0) { return; }
     throw new SketchesArgumentException("The value of the parameter \"" + argName
-        + "\" must be a positive integer-power of 2" + " and greater than 0: " + v);
+        + "\" must be a positive integer-power of 2" + " and greater than 0: " + powerOf2);
   }
 
   /**
    * Checks the given value if it is a power of 2. If not, it throws an exception.
    * Otherwise, returns the log-base2 of the given value.
-   * @param value must be a power of 2 and greater than zero.
+   * @param powerOf2 must be a power of 2 and greater than zero.
    * @param argName the argument name used in the exception if thrown.
    * @return the log-base2 of the given value
    */
-  public static int toLog2(final int value, final String argName) {
-    checkIfPowerOf2(value, argName);
-    return Integer.numberOfTrailingZeros(value);
+  public static int exactLog2(final int powerOf2, final String argName) {
+    checkIfPowerOf2(powerOf2, argName);
+    return Integer.numberOfTrailingZeros(powerOf2);
   }
 
   /**
    * Gives the log2 of a long that is known to be a power of 2.
    *
-   * @param x number that is greater than zero
+   * @param powerOf2 must be a power of 2 and greater than zero.
    * @return the log2 of a long that is known to be a power of 2.
    */
-  public static int simpleLog2OfLong(final long x) {
-    final int exp = Long.numberOfTrailingZeros(x);
-    if (x != 1L << exp) {
-      throw new SketchesArgumentException("Argument x must be a positive power of 2.");
+  public static int exactLog2OfLong(final long powerOf2) {
+    if (powerOf2 <= 0 || (powerOf2 & (powerOf2 - 1L)) != 0) {
+      throw new SketchesArgumentException("Argument 'powerOf2' must be a positive power of 2.");
     }
-    return exp;
+    return Long.numberOfTrailingZeros(powerOf2);
   }
 
   /**
diff --git a/src/main/java/org/apache/datasketches/frequencies/ItemsSketch.java b/src/main/java/org/apache/datasketches/frequencies/ItemsSketch.java
index 81345986..24b18379 100644
--- a/src/main/java/org/apache/datasketches/frequencies/ItemsSketch.java
+++ b/src/main/java/org/apache/datasketches/frequencies/ItemsSketch.java
@@ -21,7 +21,7 @@ package org.apache.datasketches.frequencies;
 
 import static org.apache.datasketches.Util.LS;
 import static org.apache.datasketches.Util.isPowerOf2;
-import static org.apache.datasketches.Util.toLog2;
+import static org.apache.datasketches.Util.exactLog2;
 import static org.apache.datasketches.frequencies.PreambleUtil.EMPTY_FLAG_MASK;
 import static org.apache.datasketches.frequencies.PreambleUtil.SER_VER;
 import static org.apache.datasketches.frequencies.PreambleUtil.extractActiveItems;
@@ -188,7 +188,7 @@ public class ItemsSketch<T> {
    * functions of maxMapSize.
    */
   public ItemsSketch(final int maxMapSize) {
-    this(toLog2(maxMapSize, "maxMapSize"), LG_MIN_MAP_SIZE);
+    this(exactLog2(maxMapSize, "maxMapSize"), LG_MIN_MAP_SIZE);
   }
 
   /**
diff --git a/src/main/java/org/apache/datasketches/frequencies/LongsSketch.java b/src/main/java/org/apache/datasketches/frequencies/LongsSketch.java
index a95f0ba7..32373fec 100644
--- a/src/main/java/org/apache/datasketches/frequencies/LongsSketch.java
+++ b/src/main/java/org/apache/datasketches/frequencies/LongsSketch.java
@@ -21,7 +21,7 @@ package org.apache.datasketches.frequencies;
 
 import static org.apache.datasketches.Util.LS;
 import static org.apache.datasketches.Util.isPowerOf2;
-import static org.apache.datasketches.Util.toLog2;
+import static org.apache.datasketches.Util.exactLog2;
 import static org.apache.datasketches.frequencies.PreambleUtil.EMPTY_FLAG_MASK;
 import static org.apache.datasketches.frequencies.PreambleUtil.SER_VER;
 import static org.apache.datasketches.frequencies.PreambleUtil.extractActiveItems;
@@ -185,7 +185,7 @@ public class LongsSketch {
    * function of maxMapSize.
    */
   public LongsSketch(final int maxMapSize) {
-    this(toLog2(maxMapSize, "maxMapSize"), LG_MIN_MAP_SIZE);
+    this(exactLog2(maxMapSize, "maxMapSize"), LG_MIN_MAP_SIZE);
   }
 
   /**
diff --git a/src/main/java/org/apache/datasketches/frequencies/ReversePurgeItemHashMap.java b/src/main/java/org/apache/datasketches/frequencies/ReversePurgeItemHashMap.java
index f80896bf..9dc6c413 100644
--- a/src/main/java/org/apache/datasketches/frequencies/ReversePurgeItemHashMap.java
+++ b/src/main/java/org/apache/datasketches/frequencies/ReversePurgeItemHashMap.java
@@ -20,7 +20,7 @@
 package org.apache.datasketches.frequencies;
 
 import static org.apache.datasketches.Util.LS;
-import static org.apache.datasketches.Util.toLog2;
+import static org.apache.datasketches.Util.exactLog2;
 import static org.apache.datasketches.frequencies.Util.hash;
 
 import java.lang.reflect.Array;
@@ -59,7 +59,7 @@ class ReversePurgeItemHashMap<T> {
    * The hash table will be expected to store LOAD_FACTOR * mapSize (key, value) pairs.
    */
   ReversePurgeItemHashMap(final int mapSize) {
-    lgLength = toLog2(mapSize, "mapSize");
+    lgLength = exactLog2(mapSize, "mapSize");
     this.loadThreshold = (int) (mapSize * LOAD_FACTOR);
     this.keys = new Object[mapSize];
     this.values = new long[mapSize];
diff --git a/src/main/java/org/apache/datasketches/frequencies/ReversePurgeLongHashMap.java b/src/main/java/org/apache/datasketches/frequencies/ReversePurgeLongHashMap.java
index dbee1ce6..ac185690 100644
--- a/src/main/java/org/apache/datasketches/frequencies/ReversePurgeLongHashMap.java
+++ b/src/main/java/org/apache/datasketches/frequencies/ReversePurgeLongHashMap.java
@@ -20,7 +20,7 @@
 package org.apache.datasketches.frequencies;
 
 import static org.apache.datasketches.Util.LS;
-import static org.apache.datasketches.Util.toLog2;
+import static org.apache.datasketches.Util.exactLog2;
 import static org.apache.datasketches.frequencies.Util.hash;
 
 import org.apache.datasketches.QuickSelect;
@@ -56,7 +56,7 @@ class ReversePurgeLongHashMap {
    * The hash table will be expected to store LOAD_FACTOR * mapSize (key, value) pairs.
    */
   ReversePurgeLongHashMap(final int mapSize) {
-    lgLength = toLog2(mapSize, "mapSize");
+    lgLength = exactLog2(mapSize, "mapSize");
     loadThreshold = (int) (mapSize * LOAD_FACTOR);
     keys = new long[mapSize];
     values = new long[mapSize];
diff --git a/src/main/java/org/apache/datasketches/hll/PreambleUtil.java b/src/main/java/org/apache/datasketches/hll/PreambleUtil.java
index eb8c95c3..a38079da 100644
--- a/src/main/java/org/apache/datasketches/hll/PreambleUtil.java
+++ b/src/main/java/org/apache/datasketches/hll/PreambleUtil.java
@@ -20,7 +20,7 @@
 package org.apache.datasketches.hll;
 
 import static org.apache.datasketches.Util.ceilingPowerOf2;
-import static org.apache.datasketches.Util.simpleLog2OfLong;
+import static org.apache.datasketches.Util.exactLog2OfLong;
 import static org.apache.datasketches.Util.zeroPad;
 import static org.apache.datasketches.hll.HllUtil.LG_AUX_ARR_INTS;
 import static org.apache.datasketches.hll.HllUtil.LG_INIT_SET_SIZE;
@@ -463,10 +463,10 @@ final class PreambleUtil {
     int ceilPwr2 = ceilingPowerOf2(count);
     if ((RESIZE_DENOM * count) > (RESIZE_NUMER * ceilPwr2)) { ceilPwr2 <<= 1; }
     if (curMode == CurMode.SET) {
-      return Math.max(LG_INIT_SET_SIZE, simpleLog2OfLong(ceilPwr2));
+      return Math.max(LG_INIT_SET_SIZE, exactLog2OfLong(ceilPwr2));
     }
     //only used for HLL4
-    return Math.max(LG_AUX_ARR_INTS[lgConfigK], simpleLog2OfLong(ceilPwr2));
+    return Math.max(LG_AUX_ARR_INTS[lgConfigK], exactLog2OfLong(ceilPwr2));
   }
 
 }
diff --git a/src/main/java/org/apache/datasketches/sampling/ReservoirItemsSketch.java b/src/main/java/org/apache/datasketches/sampling/ReservoirItemsSketch.java
index 23354a13..b85fc71c 100644
--- a/src/main/java/org/apache/datasketches/sampling/ReservoirItemsSketch.java
+++ b/src/main/java/org/apache/datasketches/sampling/ReservoirItemsSketch.java
@@ -91,7 +91,7 @@ public final class ReservoirItemsSketch<T> {
 
     itemsSeen_ = 0;
 
-    final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(reservoirSize_), "ReservoirItemsSketch");
+    final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(reservoirSize_), "ReservoirItemsSketch");
     final int initialLgSize =
             SamplingUtil.startingSubMultiple(ceilingLgK, rf_.lg(), MIN_LG_ARR_ITEMS);
 
@@ -249,8 +249,8 @@ public final class ReservoirItemsSketch<T> {
     if (itemsSeen < k) {
       // under-full so determine size to allocate, using ceilingLog2(totalSeen) as minimum
       // casts to int are safe since under-full
-      final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(k), "heapify");
-      final int minLgSize = Util.toLog2(Util.ceilingPowerOf2((int) itemsSeen), "heapify");
+      final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(k), "heapify");
+      final int minLgSize = Util.exactLog2(Util.ceilingPowerOf2((int) itemsSeen), "heapify");
       final int initialLgSize = SamplingUtil.startingSubMultiple(ceilingLgK, rf.lg(),
               Math.max(minLgSize, MIN_LG_ARR_ITEMS));
 
@@ -335,7 +335,7 @@ public final class ReservoirItemsSketch<T> {
    * Resets this sketch to the empty state, but retains the original value of k.
    */
   public void reset() {
-    final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(reservoirSize_), "ReservoirItemsSketch");
+    final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(reservoirSize_), "ReservoirItemsSketch");
     final int initialLgSize =
             SamplingUtil.startingSubMultiple(ceilingLgK, rf_.lg(), MIN_LG_ARR_ITEMS);
 
diff --git a/src/main/java/org/apache/datasketches/sampling/ReservoirLongsSketch.java b/src/main/java/org/apache/datasketches/sampling/ReservoirLongsSketch.java
index b4ff266b..e70dfb20 100644
--- a/src/main/java/org/apache/datasketches/sampling/ReservoirLongsSketch.java
+++ b/src/main/java/org/apache/datasketches/sampling/ReservoirLongsSketch.java
@@ -92,7 +92,7 @@ public final class ReservoirLongsSketch {
 
     itemsSeen_ = 0;
 
-    final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(reservoirSize_), "ReservoirLongsSketch");
+    final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(reservoirSize_), "ReservoirLongsSketch");
     final int initialLgSize =
             SamplingUtil.startingSubMultiple(ceilingLgK, rf_.lg(), MIN_LG_ARR_LONGS);
 
@@ -229,8 +229,8 @@ public final class ReservoirLongsSketch {
     if (itemsSeen < k) {
       // under-full so determine size to allocate, using ceilingLog2(totalSeen) as minimum
       // casts to int are safe since under-full
-      final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(k), "heapify");
-      final int minLgSize = Util.toLog2(Util.ceilingPowerOf2((int) itemsSeen), "heapify");
+      final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(k), "heapify");
+      final int minLgSize = Util.exactLog2(Util.ceilingPowerOf2((int) itemsSeen), "heapify");
       final int initialLgSize = SamplingUtil.startingSubMultiple(ceilingLgK, rf.lg(),
               Math.max(minLgSize, MIN_LG_ARR_LONGS));
 
@@ -334,7 +334,7 @@ public final class ReservoirLongsSketch {
    * Resets this sketch to the empty state, but retains the original value of k.
    */
   public void reset() {
-    final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(reservoirSize_),
+    final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(reservoirSize_),
             "ReservoirLongsSketch");
     final int initialLgSize =
             SamplingUtil.startingSubMultiple(ceilingLgK, rf_.lg(), MIN_LG_ARR_LONGS);
diff --git a/src/main/java/org/apache/datasketches/sampling/ReservoirSize.java b/src/main/java/org/apache/datasketches/sampling/ReservoirSize.java
index 047b9842..0594b5eb 100644
--- a/src/main/java/org/apache/datasketches/sampling/ReservoirSize.java
+++ b/src/main/java/org/apache/datasketches/sampling/ReservoirSize.java
@@ -76,7 +76,7 @@ final class ReservoirSize {
               + "less than " + MAX_ABS_VALUE + ", found: " + k);
     }
 
-    final int p = Util.toLog2(Util.floorPowerOf2(k), "computeSize: p");
+    final int p = Util.exactLog2(Util.floorPowerOf2(k), "computeSize: p");
 
     // because of floor() + 1 below, need to check power of 2 here
     if (Util.isPowerOf2(k)) {
diff --git a/src/main/java/org/apache/datasketches/sampling/VarOptItemsSketch.java b/src/main/java/org/apache/datasketches/sampling/VarOptItemsSketch.java
index dfd3db1d..e3866a1a 100644
--- a/src/main/java/org/apache/datasketches/sampling/VarOptItemsSketch.java
+++ b/src/main/java/org/apache/datasketches/sampling/VarOptItemsSketch.java
@@ -136,7 +136,7 @@ public final class VarOptItemsSketch<T> {
     totalWtR_ = 0;
     numMarksInH_ = 0;
 
-    final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(k_), "VarOptItemsSketch");
+    final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(k_), "VarOptItemsSketch");
     final int initialLgSize =
             SamplingUtil.startingSubMultiple(ceilingLgK, rf_.lg(), MIN_LG_ARR_ITEMS);
 
@@ -347,8 +347,8 @@ public final class VarOptItemsSketch<T> {
 
     if (rCount == 0) {
       // Not in sampling mode, so determine size to allocate, using ceilingLog2(hCount) as minimum
-      final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(k), "heapify");
-      final int minLgSize = Util.toLog2(Util.ceilingPowerOf2(hCount), "heapify");
+      final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(k), "heapify");
+      final int minLgSize = Util.exactLog2(Util.ceilingPowerOf2(hCount), "heapify");
       final int initialLgSize = SamplingUtil.startingSubMultiple(ceilingLgK, rf.lg(),
               Math.max(minLgSize, MIN_LG_ARR_ITEMS));
 
@@ -474,7 +474,7 @@ public final class VarOptItemsSketch<T> {
    * Resets this sketch to the empty state, but retains the original value of k.
    */
   public void reset() {
-    final int ceilingLgK = Util.toLog2(Util.ceilingPowerOf2(k_), "VarOptItemsSketch");
+    final int ceilingLgK = Util.exactLog2(Util.ceilingPowerOf2(k_), "VarOptItemsSketch");
     final int initialLgSize =
             SamplingUtil.startingSubMultiple(ceilingLgK, rf_.lg(), MIN_LG_ARR_ITEMS);
 
diff --git a/src/main/java/org/apache/datasketches/theta/AnotBimpl.java b/src/main/java/org/apache/datasketches/theta/AnotBimpl.java
index 77e290e3..06c6812f 100644
--- a/src/main/java/org/apache/datasketches/theta/AnotBimpl.java
+++ b/src/main/java/org/apache/datasketches/theta/AnotBimpl.java
@@ -24,7 +24,7 @@ import static org.apache.datasketches.HashOperations.hashSearch;
 import static org.apache.datasketches.Util.REBUILD_THRESHOLD;
 import static org.apache.datasketches.Util.checkSeedHashes;
 import static org.apache.datasketches.Util.computeSeedHash;
-import static org.apache.datasketches.Util.simpleLog2OfLong;
+import static org.apache.datasketches.Util.exactLog2OfLong;
 
 import java.util.Arrays;
 
@@ -184,7 +184,7 @@ final class AnotBimpl extends AnotB {
     final long[] tmpHashArrA = new long[countA];
 
     //search for non matches and build temp arrays
-    final int lgHTBLen = simpleLog2OfLong(hashTableB.length);
+    final int lgHTBLen = exactLog2OfLong(hashTableB.length);
     int nonMatches = 0;
     for (int i = 0; i < countA; i++) {
       final long hash = hashArrA[i];
diff --git a/src/main/java/org/apache/datasketches/tuple/AnotB.java b/src/main/java/org/apache/datasketches/tuple/AnotB.java
index 462f9e01..305e2f97 100644
--- a/src/main/java/org/apache/datasketches/tuple/AnotB.java
+++ b/src/main/java/org/apache/datasketches/tuple/AnotB.java
@@ -23,7 +23,7 @@ import static java.lang.Math.min;
 import static org.apache.datasketches.HashOperations.convertToHashTable;
 import static org.apache.datasketches.HashOperations.hashSearch;
 import static org.apache.datasketches.Util.REBUILD_THRESHOLD;
-import static org.apache.datasketches.Util.simpleLog2OfLong;
+import static org.apache.datasketches.Util.exactLog2OfLong;
 
 import java.lang.reflect.Method;
 import java.util.Arrays;
@@ -522,7 +522,7 @@ public final class AnotB<S extends Summary> {
     final S[] tmpSummaryArrA = Util.newSummaryArray(summaryArrA, countA);
 
     //search for non matches and build temp arrays
-    final int lgHTBLen = simpleLog2OfLong(hashTableB.length);
+    final int lgHTBLen = exactLog2OfLong(hashTableB.length);
     int nonMatches = 0;
     for (int i = 0; i < countA; i++) {
       final long hash = hashArrA[i];
@@ -568,7 +568,7 @@ public final class AnotB<S extends Summary> {
     final S[] tmpSummaryArrA = Util.newSummaryArray(summaryArrA, countA);
 
     //search for non matches and build temp arrays
-    final int lgHTBLen = simpleLog2OfLong(hashTableB.length);
+    final int lgHTBLen = exactLog2OfLong(hashTableB.length);
     int nonMatches = 0;
     for (int i = 0; i < countA; i++) {
       final long hash = hashArrA[i];
diff --git a/src/main/java/org/apache/datasketches/tuple/QuickSelectSketch.java b/src/main/java/org/apache/datasketches/tuple/QuickSelectSketch.java
index 56ec0498..fdd9f125 100644
--- a/src/main/java/org/apache/datasketches/tuple/QuickSelectSketch.java
+++ b/src/main/java/org/apache/datasketches/tuple/QuickSelectSketch.java
@@ -23,7 +23,7 @@ import static org.apache.datasketches.HashOperations.count;
 import static org.apache.datasketches.Util.REBUILD_THRESHOLD;
 import static org.apache.datasketches.Util.RESIZE_THRESHOLD;
 import static org.apache.datasketches.Util.ceilingPowerOf2;
-import static org.apache.datasketches.Util.simpleLog2OfLong;
+import static org.apache.datasketches.Util.exactLog2OfLong;
 
 import java.lang.reflect.Array;
 import java.nio.ByteOrder;
@@ -261,7 +261,7 @@ class QuickSelectSketch<S extends Summary> extends Sketch<S> {
    * @return log_base2 of Nominal Entries
    */
   public int getLgK() {
-    return simpleLog2OfLong(nomEntries_);
+    return exactLog2OfLong(nomEntries_);
   }
 
   /**
diff --git a/src/main/java/org/apache/datasketches/tuple/arrayofdoubles/ArrayOfDoublesAnotBImpl.java b/src/main/java/org/apache/datasketches/tuple/arrayofdoubles/ArrayOfDoublesAnotBImpl.java
index a64116b3..dd6b1f7e 100644
--- a/src/main/java/org/apache/datasketches/tuple/arrayofdoubles/ArrayOfDoublesAnotBImpl.java
+++ b/src/main/java/org/apache/datasketches/tuple/arrayofdoubles/ArrayOfDoublesAnotBImpl.java
@@ -25,7 +25,7 @@ import static org.apache.datasketches.HashOperations.convertToHashTable;
 import static org.apache.datasketches.HashOperations.count;
 import static org.apache.datasketches.HashOperations.hashSearch;
 import static org.apache.datasketches.Util.REBUILD_THRESHOLD;
-import static org.apache.datasketches.Util.simpleLog2OfLong;
+import static org.apache.datasketches.Util.exactLog2OfLong;
 
 import java.util.Arrays;
 
@@ -174,7 +174,7 @@ public class ArrayOfDoublesAnotBImpl extends ArrayOfDoublesAnotB {
     double[] tmpValuesArrA = new double[countA * numValues];
 
     //search for non matches and build temp arrays
-    final int lgHTBLen = simpleLog2OfLong(hashTableB.length);
+    final int lgHTBLen = exactLog2OfLong(hashTableB.length);
     int nonMatches = 0;
     for (int i = 0; i < countA; i++) {
       final long hash = hashArrA[i];
diff --git a/src/main/java/org/apache/datasketches/tuple/arrayofdoubles/HeapArrayOfDoublesQuickSelectSketch.java b/src/main/java/org/apache/datasketches/tuple/arrayofdoubles/HeapArrayOfDoublesQuickSelectSketch.java
index f1a19bc1..cfdb28d4 100644
--- a/src/main/java/org/apache/datasketches/tuple/arrayofdoubles/HeapArrayOfDoublesQuickSelectSketch.java
+++ b/src/main/java/org/apache/datasketches/tuple/arrayofdoubles/HeapArrayOfDoublesQuickSelectSketch.java
@@ -20,7 +20,7 @@
 package org.apache.datasketches.tuple.arrayofdoubles;
 
 import static org.apache.datasketches.Util.ceilingPowerOf2;
-import static org.apache.datasketches.Util.simpleLog2OfLong;
+import static org.apache.datasketches.Util.exactLog2OfLong;
 
 import java.nio.ByteOrder;
 import java.util.Arrays;
@@ -66,7 +66,7 @@ final class HeapArrayOfDoublesQuickSelectSketch extends ArrayOfDoublesQuickSelec
   HeapArrayOfDoublesQuickSelectSketch(final int nomEntries, final int lgResizeFactor,
       final float samplingProbability, final int numValues, final long seed) {
     super(numValues, seed);
-    lgNomEntries_ = simpleLog2OfLong(ceilingPowerOf2(nomEntries));
+    lgNomEntries_ = exactLog2OfLong(ceilingPowerOf2(nomEntries));
     lgResizeFactor_ = lgResizeFactor;
     samplingProbability_ = samplingProbability;
     thetaLong_ = (long) (Long.MAX_VALUE * (double) samplingProbability);
diff --git a/src/test/java/org/apache/datasketches/UtilTest.java b/src/test/java/org/apache/datasketches/UtilTest.java
index 88e5ae0b..a388a96e 100644
--- a/src/test/java/org/apache/datasketches/UtilTest.java
+++ b/src/test/java/org/apache/datasketches/UtilTest.java
@@ -32,6 +32,7 @@ import static org.apache.datasketches.Util.checkProbability;
 import static org.apache.datasketches.Util.evenlyLogSpaced;
 import static org.apache.datasketches.Util.evenlySpaced;
 import static org.apache.datasketches.Util.evenlySpacedFloats;
+import static org.apache.datasketches.Util.exactLog2OfLong;
 import static org.apache.datasketches.Util.floorPowerOf2;
 import static org.apache.datasketches.Util.floorPowerOfBdouble;
 import static org.apache.datasketches.Util.getResourceBytes;
@@ -47,7 +48,6 @@ import static org.apache.datasketches.Util.numberOfTrailingOnes;
 import static org.apache.datasketches.Util.pwr2LawNext;
 import static org.apache.datasketches.Util.pwr2LawPrev;
 import static org.apache.datasketches.Util.pwrLawNextDouble;
-import static org.apache.datasketches.Util.simpleLog2OfLong;
 import static org.apache.datasketches.Util.zeroPad;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertTrue;
@@ -377,11 +377,11 @@ public class UtilTest {
 
   @Test
   public void checkSimpleLog2OfLong() {
-    Assert.assertEquals(simpleLog2OfLong(2), 1);
-    Assert.assertEquals(simpleLog2OfLong(1), 0);
-    Assert.assertEquals(simpleLog2OfLong(1L << 62), 62);
+    Assert.assertEquals(exactLog2OfLong(2), 1);
+    Assert.assertEquals(exactLog2OfLong(1), 0);
+    Assert.assertEquals(exactLog2OfLong(1L << 62), 62);
     try {
-      simpleLog2OfLong(0);
+      exactLog2OfLong(0);
       fail();
     } catch (final SketchesArgumentException e) { }
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org