Class DataSizeRoundingUtil

java.lang.Object
org.apache.arrow.vector.util.DataSizeRoundingUtil

public final class DataSizeRoundingUtil extends Object
Utilities for rounding data size.
  • Field Details

    • ROUND_8_MASK_INT

      public static int ROUND_8_MASK_INT
      The mask for rounding an integer to a multiple of 8. (i.e. clear the lowest 3 bits)
    • ROUND_8_MASK_LONG

      public static long ROUND_8_MASK_LONG
      The mask for rounding a long integer to a multiple of 8. (i.e. clear the lowest 3 bits)
    • DIVIDE_BY_8_SHIFT_BITS

      public static int DIVIDE_BY_8_SHIFT_BITS
      The number of bits to shift for dividing by 8.
  • Method Details

    • roundUpTo8Multiple

      public static int roundUpTo8Multiple(int input)
      Round up the number to the nearest multiple of 8.
      Parameters:
      input - the number to round.
      Returns:
      the rounded number.
    • roundUpTo8Multiple

      public static long roundUpTo8Multiple(long input)
      Round up the number to the nearest multiple of 8.
      Parameters:
      input - the number to round.
      Returns:
      the rounded number
    • roundDownTo8Multiple

      public static int roundDownTo8Multiple(int input)
      Round down the number to the nearest multiple of 8.
      Parameters:
      input - the number to round.
      Returns:
      the rounded number.
    • roundDownTo8Multiple

      public static long roundDownTo8Multiple(long input)
      Round down the number to the nearest multiple of 8.
      Parameters:
      input - the number to round.
      Returns:
      the rounded number
    • divideBy8Ceil

      public static int divideBy8Ceil(int input)
      A fast way to compute Math.ceil(input / 8.0).
      Parameters:
      input - the input number.
      Returns:
      the computed number.
    • divideBy8Ceil

      public static long divideBy8Ceil(long input)
      A fast way to compute Math.ceil(input / 8.0).
      Parameters:
      input - the input number.
      Returns:
      the computed number.
    • roundUpToMultipleOf16

      public static long roundUpToMultipleOf16(long num)