@Test public void testEvaluateBinaryBigInteger() { OpBehaviorIntCarry op = new OpBehaviorIntCarry(); BigInteger NEGATIVE_ONE = new BigInteger("FFFFFFFFFFFFFFFF", 16); BigInteger BIG_POSITIVE = new BigInteger("7FFFFFFFFFFFFFFF", 16); BigInteger BIG_NEGATIVE = new BigInteger("8000000000000000", 16); Assert.assertEquals(BigInteger.ZERO, op.evaluateBinary(8, 8, BigInteger.ZERO, BigInteger.ZERO)); Assert.assertEquals(BigInteger.ONE, op.evaluateBinary(8, 8, BigInteger.ONE, NEGATIVE_ONE)); Assert.assertEquals(BigInteger.ONE, op.evaluateBinary(8, 8, NEGATIVE_ONE, BigInteger.ONE)); Assert.assertEquals(BigInteger.ZERO, op.evaluateBinary(8, 8, BIG_POSITIVE, BIG_NEGATIVE)); Assert.assertEquals(BigInteger.ONE, op.evaluateBinary(8, 8, BIG_POSITIVE, BIG_NEGATIVE.add(BigInteger.ONE))); Assert.assertEquals(BigInteger.ZERO, op.evaluateBinary(8, 8, BIG_NEGATIVE, BIG_POSITIVE)); Assert.assertEquals(BigInteger.ONE, op.evaluateBinary(8, 8, BIG_NEGATIVE.add(BigInteger.ONE), BIG_POSITIVE)); }
@Override public long evaluateBinary(int sizeout, int sizein, long in1, long in2) { if (sizein == 8) { if (in1 < 0) { return ((in2 < 0) || (-in2 <= in1)) ? 1 : 0; } if (in2 < 0) { return (-in1 <= in2) ? 1 : 0; } } return (in1 > ((in1 + in2) & Utils.calc_mask(sizein))) ? 1 : 0; }
OpBehaviorIntCarry extends BinaryOpBehavior { @Override public long evaluateBinary(int sizeout, int sizein, long in1, long in2) { if (sizein == 8) { if (in1 < 0) { return ((in2 < 0) || (-in2 <= in1)) ? 1 : 0; } if (in2 < 0) { return (-in1 <= in2) ? 1 : 0; } } return (in1 > ((in1 + in2) & Utils.calc_mask(sizein))) ? 1 : 0; } }
OpBehaviorIntCarry extends BinaryOpBehavior { @Override public long evaluateBinary(int sizeout, int sizein, long in1, long in2) { if (sizein == 8) { if (in1 < 0) { return ((in2 < 0) || (-in2 <= in1)) ? 1 : 0; } if (in2 < 0) { return (-in1 <= in2) ? 1 : 0; } } return (in1 > ((in1 + in2) & Utils.calc_mask(sizein))) ? 1 : 0; } OpBehaviorIntCarry(); }
OpBehaviorIntCarry extends BinaryOpBehavior { @Override public long evaluateBinary(int sizeout, int sizein, long in1, long in2) { if (sizein == 8) { if (in1 < 0) { return ((in2 < 0) || (-in2 <= in1)) ? 1 : 0; } if (in2 < 0) { return (-in1 <= in2) ? 1 : 0; } } return (in1 > ((in1 + in2) & Utils.calc_mask(sizein))) ? 1 : 0; } OpBehaviorIntCarry(); @Override long evaluateBinary(int sizeout, int sizein, long in1, long in2); @Override BigInteger evaluateBinary(int sizeout, int sizein, BigInteger in1, BigInteger in2); }
OpBehaviorIntCarry extends BinaryOpBehavior { @Override public long evaluateBinary(int sizeout, int sizein, long in1, long in2) { if (sizein == 8) { if (in1 < 0) { return ((in2 < 0) || (-in2 <= in1)) ? 1 : 0; } if (in2 < 0) { return (-in1 <= in2) ? 1 : 0; } } return (in1 > ((in1 + in2) & Utils.calc_mask(sizein))) ? 1 : 0; } OpBehaviorIntCarry(); @Override long evaluateBinary(int sizeout, int sizein, long in1, long in2); @Override BigInteger evaluateBinary(int sizeout, int sizein, BigInteger in1, BigInteger in2);  }