Package com.google.gwt.lang.LongLibBase

Examples of com.google.gwt.lang.LongLibBase.LongEmul


        longFromBits(0x92345678, 0x9abcdef0), 48));
  }

  // Issue 1198, and also a good exercise of several methods.
  public void testToHexString() {
    LongEmul deadbeaf12341234 = longFromBits(0xdeadbeaf, 0x12341234);

    assertEquals("0", toHexString(Const.ZERO));
    assertEquals("deadbeaf12341234", toHexString(deadbeaf12341234));
  }
View Full Code Here


    assertEquals("-10", LongLib.toString(LongLib.fromInt(-10)));
    assertEquals("-9223372036854775808", LongLib.toString(Const.MIN_VALUE));

    int top = 922337201;
    int bottom = 967490662;
    LongEmul fullnum = LongLib.add(LongLib.mul(LongLib.fromInt(1000000000),
        LongLib.fromInt(top)), LongLib.fromInt(bottom));

    assertEquals("922337201967490662", LongLib.toString(fullnum));
    assertEquals("-922337201967490662", LongLib.toString(LongLib.neg(fullnum)));
  }
View Full Code Here

      return LongLib.mul(n, fact(LongLib.sub(n, LongLib.fromInt(1))));
    }
  }

  private LongEmul longFromBits(int top, int bottom) {
    LongEmul topHalf = LongLib.shl(LongLib.fromInt(top), 32);
    LongEmul bottomHalf = LongLib.fromInt(bottom);
    if (LongLib.lt(bottomHalf, Const.ZERO)) {
      bottomHalf = LongLib.add(bottomHalf, LongLib.shl(LongLib.fromInt(1), 32));
    }
    LongEmul total = LongLib.add(topHalf, bottomHalf);
    return total;
  }
View Full Code Here

    LongEmul total = LongLib.add(topHalf, bottomHalf);
    return total;
  }

  private String toHexString(LongEmul x) {
    LongEmul zero = LongLib.fromInt(0);

    if (LongLib.eq(x, zero)) {
      return "0";
    }
    String[] hexDigits = new String[] {
View Full Code Here

TOP

Related Classes of com.google.gwt.lang.LongLibBase.LongEmul

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.