@Override
 public @NonNull IntegerValue addInteger(@NonNull IntegerValue right) {
   if (right instanceof IntIntegerValueImpl) {
     int thatValue = ((IntIntegerValueImpl) right).intValue();
     int sum = value + thatValue;
     if (value >= 0) {
       if ((thatValue >= 0) && (sum >= 0)) {
         return ValueUtil.integerValueOf(sum);
       }
     } else {
       if ((thatValue <= 0) && (sum <= 0)) {
         return ValueUtil.integerValueOf(sum);
       }
     }
     return ValueUtil.integerValueOf((long) value + (long) thatValue);
   } else if (right instanceof LongIntegerValueImpl) {
     long thatValue = ((LongIntegerValueImpl) right).longValue();
     return ValueUtil.integerValueOf(value + thatValue);
   } else {
     @SuppressWarnings("null")
     @NonNull
     BigInteger result = bigIntegerValue().add(right.bigIntegerValue());
     return ValueUtil.integerValueOf(result);
   }
 }
 @Override
 public @NonNull IntegerValue subtractInteger(@NonNull IntegerValue right) {
   if (right instanceof IntIntegerValueImpl) {
     int thatValue = ((IntIntegerValueImpl) right).intValue();
     int diff = value - thatValue;
     if (value >= 0) {
       if ((thatValue <= 0) && (diff >= 0)) {
         return ValueUtil.integerValueOf(diff);
       }
     } else {
       if ((thatValue >= 0) && (diff <= 0)) {
         return ValueUtil.integerValueOf(diff);
       }
     }
     return ValueUtil.integerValueOf((long) value - (long) thatValue);
   } else if (right instanceof LongIntegerValueImpl) {
     long thatValue = ((LongIntegerValueImpl) right).longValue();
     return ValueUtil.integerValueOf(value - thatValue);
   } else {
     @SuppressWarnings("null")
     @NonNull
     BigInteger result = bigIntegerValue().subtract(right.bigIntegerValue());
     return ValueUtil.integerValueOf(result);
   }
 }
 @Override
 public @NonNull IntegerValue negate() {
   if (value > Integer.MIN_VALUE) {
     return ValueUtil.integerValueOf(-value);
   } else {
     return ValueUtil.integerValueOf(1L << Integer.SIZE - 1);
   }
 }
 @Override
 public @NonNull IntegerValue multiplyInteger(@NonNull IntegerValue right) {
   if (right instanceof IntIntegerValueImpl) {
     long thatValue = ((IntIntegerValueImpl) right).intValue();
     return ValueUtil.integerValueOf(value * thatValue);
   } else {
     @SuppressWarnings("null")
     @NonNull
     BigInteger result = bigIntegerValue().multiply(right.bigIntegerValue());
     return ValueUtil.integerValueOf(result);
   }
 }
 @Override
 public @NonNull IntegerValue modInteger(@NonNull IntegerValue right) {
   if (right.bigIntegerValue().signum() == 0) {
     throw new InvalidValueException("mod zero");
   }
   if (right instanceof IntIntegerValueImpl) {
     int thatValue = ((IntIntegerValueImpl) right).intValue();
     return ValueUtil.integerValueOf(value % thatValue);
   } else if (right instanceof LongIntegerValueImpl) {
     long thatValue = ((LongIntegerValueImpl) right).longValue();
     return ValueUtil.integerValueOf(value % thatValue);
   } else {
     @SuppressWarnings("null")
     @NonNull
     BigInteger result = bigIntegerValue().remainder(right.bigIntegerValue());
     return ValueUtil.integerValueOf(result);
   }
 }
 @Override
 public @NonNull IntegerValue divInteger(@NonNull IntegerValue right) {
   if (right.bigIntegerValue().signum() == 0) {
     throw new InvalidValueException("div zero");
   }
   @SuppressWarnings("null")
   @NonNull
   BigInteger result = bigIntegerValue().divide(right.bigIntegerValue());
   return ValueUtil.integerValueOf(result);
 }