class OpBehaviorIntDiv extends BinaryOpBehavior {

	@Override
	public long evaluateBinary(int sizeout, int sizein, long in1, long in2) {
		if (sizein <= 0 || in2 == 0)
			return 0;
		if (in1 == in2)
			return 1;
		if (sizein == 8) {
			long mask = (0x1<<63);
			long bit1 = in1 & mask; // Get the sign bits
			long bit2 = in2 & mask;
			if (bit1 != 0 || bit2 != 0) {
				// use BigInteger to perform 64-bit unsigned division if one negative input
				BigInteger bigIn1 =
					Utils.bytesToBigInteger(Utils.longToBytes(in1, sizein, true), sizein, true,
						false);
				if (bigIn1.signum() < 0) {
					bigIn1 = Utils.convertToUnsignedValue(bigIn1, sizein);
				}
				BigInteger bigIn2 =
					Utils.bytesToBigInteger(Utils.longToBytes(in2, sizein, true), sizein, true,
						false);
				if (bigIn2.signum() < 0) {
					bigIn2 = Utils.convertToUnsignedValue(bigIn2, sizein);
				}
				BigInteger result = bigIn1.divide(bigIn2);
				return result.longValue() & Utils.calc_mask(sizeout);
			}
		}

		return (in1 / in2) & Utils.calc_mask(sizeout);
	}

	public  OpBehaviorIntDiv();

}