Package org.openjdk.jol.util
Class MathUtil
java.lang.Object
org.openjdk.jol.util.MathUtil
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic int
align
(int v, int a) Aligns the argument to the given alignment.static long
align
(long v, int a) Aligns the argument to the given alignment.static long
gcd
(long a, long b) static int
log2p
(int x) static int
minDiff
(int... offs) static int
pow2
(int power)
-
Constructor Details
-
MathUtil
public MathUtil()
-
-
Method Details
-
log2p
public static int log2p(int x) -
minDiff
public static int minDiff(int... offs) -
gcd
public static long gcd(long a, long b) -
pow2
public static int pow2(int power) -
align
public static int align(int v, int a) Aligns the argument to the given alignment. Alignment should be a power of two.- Parameters:
v
- value to aligna
- alignment, should be power of two- Returns:
- aligned value
-
align
public static long align(long v, int a) Aligns the argument to the given alignment. Alignment should be a power of two.- Parameters:
v
- value to aligna
- alignment, should be power of two- Returns:
- aligned value
-