Package ghidra.util
Class MathUtilities
- java.lang.Object
-
- ghidra.util.MathUtilities
-
public class MathUtilities extends java.lang.Object
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static intclamp(int value, int min, int max)Ensures that the given value is within the given range.static voidmain(java.lang.String[] args)static longunsignedDivide(long numerator, long denominator)Perform unsigned division.static longunsignedModulo(long numerator, long denominator)Perform unsigned modulo.
-
-
-
Method Detail
-
unsignedDivide
public static long unsignedDivide(long numerator, long denominator)Perform unsigned division. Provides proper handling of all 64-bit unsigned values.- Parameters:
numerator- unsigned numeratordenominator- positive divisor- Returns:
- result of unsigned division
- Throws:
java.lang.IllegalArgumentException- if negative denominator is specified
-
unsignedModulo
public static long unsignedModulo(long numerator, long denominator)Perform unsigned modulo. Provides proper handling of all 64-bit unsigned values.- Parameters:
numerator- unsigned numeratordenominator- positive divisor- Returns:
- result of unsigned modulo (i.e., remainder)
- Throws:
java.lang.IllegalArgumentException- if negative denominator is specified
-
clamp
public static int clamp(int value, int min, int max)Ensures that the given value is within the given range.- Parameters:
value- the value to checkmin- the minimum value allowedmax- the maximum value allowed- Returns:
- the clamped value
-
main
public static void main(java.lang.String[] args)
-
-