Commit c9e4c2f9 authored by iSergio's avatar iSergio
Browse files

Added Math.previousPowerOfTwo.

parent 0b725e20
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -570,6 +570,15 @@ public class Math {
  @JsMethod
  public static native double normalize(double value, double rangeMinimum, double rangeMaximum);

  /**
   * Computes the previous power-of-two integer less than or equal to the provided non-negative integer.
   * The maximum allowed input is (2^32)-1 due to 32-bit bitwise operator limitation in Javascript.
   * @param n The integer to test in the range [0, (2^32)-1].
   * @return The previous power-of-two integer.
   */
  @JsMethod
  public static native double previousPowerOfTwo(double n);

  /**
   * Generates a random number between two numbers.
   *