Package org.apache.arrow.vector.util
Class DataSizeRoundingUtil
java.lang.Object
org.apache.arrow.vector.util.DataSizeRoundingUtil
Utilities for rounding data size.
-
Field Summary
Modifier and TypeFieldDescriptionstatic int
The number of bits to shift for dividing by 8.static int
The mask for rounding an integer to a multiple of 8.static long
The mask for rounding a long integer to a multiple of 8. -
Method Summary
Modifier and TypeMethodDescriptionstatic int
divideBy8Ceil
(int input) A fast way to compute Math.ceil(input / 8.0).static long
divideBy8Ceil
(long input) A fast way to compute Math.ceil(input / 8.0).static int
roundDownTo8Multiple
(int input) Round down the number to the nearest multiple of 8.static long
roundDownTo8Multiple
(long input) Round down the number to the nearest multiple of 8.static int
roundUpTo8Multiple
(int input) Round up the number to the nearest multiple of 8.static long
roundUpTo8Multiple
(long input) Round up the number to the nearest multiple of 8.static long
roundUpToMultipleOf16
(long num)
-
Field Details
-
ROUND_8_MASK_INT
public static int ROUND_8_MASK_INTThe 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_LONGThe 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_BITSThe 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)
-