Package ghidra.util

Class MathUtilities


  • public class MathUtilities
    extends java.lang.Object
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int clamp​(int value, int min, int max)
      Ensures that the given value is within the given range.
      static void main​(java.lang.String[] args)  
      static long unsignedDivide​(long numerator, long denominator)
      Perform unsigned division.
      static long unsignedModulo​(long numerator, long denominator)
      Perform unsigned modulo.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 numerator
        denominator - 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 numerator
        denominator - 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 check
        min - the minimum value allowed
        max - the maximum value allowed
        Returns:
        the clamped value
      • main

        public static void main​(java.lang.String[] args)