Class 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)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MathUtil

        public MathUtil()
    • 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 align
        a - 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 align
        a - alignment, should be power of two
        Returns:
        aligned value