Package org.openjdk.jol.util
Class MathUtil
- java.lang.Object
-
- org.openjdk.jol.util.MathUtil
-
public class MathUtil extends java.lang.Object
-
-
Constructor Summary
Constructors Constructor Description MathUtil()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static 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)
-
-
-
Method Detail
-
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
-
-