コード例 #1
0
  private static Region[] arithmeticOperation(
      final Region[] l,
      final Region[] r,
      final BitvectorManager bvmgr,
      final BinaryOperator op,
      final CType calculationType,
      final MachineModel machineModel) {

    switch (op) {
      case PLUS:
        return bvmgr.makeAdd(l, r);
      case MINUS:
        return bvmgr.makeSub(l, r);
      case DIVIDE:
      case MODULO:
      case MULTIPLY:
        // TODO implement multiplier circuit for Regions/BDDs?
        // this would be working for constant numbers (2*3), however timeout for variables (a*b ->
        // exponential bdd-size).
        return null;
      case SHIFT_LEFT:
      case SHIFT_RIGHT:
        // TODO implement shift circuit? this should be easier than multiplier,
        // because 'r' is smaller (max 64 for longlong), so many positions can be ignored
        return null;
      case BINARY_AND:
        return bvmgr.makeBinaryAnd(l, r);
      case BINARY_OR:
        return bvmgr.makeBinaryOr(l, r);
      case BINARY_XOR:
        return bvmgr.makeXor(l, r);

      default:
        throw new AssertionError("unknown binary operation: " + op);
    }
  }