Class BitFields

java.lang.Object
io.nosqlbench.virtdata.lib.vectors.util.BitFields

public class BitFields extends Object
  • Constructor Details

    • BitFields

      public BitFields()
  • Method Details

    • alignReducedBits

      public static int[] alignReducedBits(int[] values)
      Reduce the discrete magnitude of values by the same amount, to allow any IEEE floating point values to remain closer to the higher-precision part of the value space. This will reduce rounding error for downstream operations which are based on floating point casts of integer values.
      Parameters:
      values - An array of integers
      Returns:
      A scaled-down array of integers
    • getLsbZeroBits

      public static int getLsbZeroBits(int value)
      Returns:
      The number of lower-order bits which are zero in the value
    • getMsbPosition

      public static int getMsbPosition(int value)
      Returns:
      The position of the most significant bit, with the lsb represented as 1.
    • reverseBits

      public static int reverseBits(int x)
    • reverseIntBitsUnsigned

      public static int reverseIntBitsUnsigned(int x)
    • rotateBitspace

      public static int rotateBitspace(int initial, int amount, int shift)
      Increment or decrement the initial bitfield value by some amount, offset into higher 2^scale resolution.
      Parameters:
      initial - The initial bitfield image
      amount - The value to add (positive or negative) to the initial value
      shift - The number of bits to shift left before, and right after the increment
      Returns:
      The initial value incremented by the amount at some scale determined by shift