public final class PowerOf2Util extends Object
Modifier and Type | Method and Description |
---|---|
static int |
align(int value,
int pow2alignment)
Fast alignment operation with power of 2
alignment and value >=0 and value < Integer.MAX_VALUE .In order to be fast is up to the caller to check arguments correctness. |
static boolean |
isAligned(long value,
int pow2alignment)
Test if a value is pow2alignment-aligned.
|
static boolean |
isPowOf2(int value)
Is a value a positive power of two.
|
public static int align(int value, int pow2alignment)
alignment
and value >=0
and value <
Integer.MAX_VALUE
.public static boolean isPowOf2(int value)
value
- to be checked.public static boolean isAligned(long value, int pow2alignment)
value
- to be tested.pow2alignment
- boundary the address is tested against.IllegalArgumentException
- if the alignment is not a power of 2Copyright © 2021 JBoss by Red Hat. All rights reserved.