(op1: Constant, op2: Constant)
| 344 | if is_i128_class(class_name) || is_u128_class(class_name) => |
| 345 | { |
| 346 | let bi1 = parse_constant_to_bigint(&unified_op1).ok()?; |
| 347 | let bi2 = parse_constant_to_bigint(&unified_op2).ok()?; |
| 348 | if bi2.is_zero() { |
| 349 | return None; |
| 350 | } // Division by zero |
| 351 | // Use checked_div for integer division semantics (truncates) |
| 352 | bi1.checked_div(&bi2) |
| 353 | .and_then(|value| bigint_to_integer_constant_like(value, &unified_op1)) |
| 354 | } |
| 355 | _ => { |
| 356 | primitive_arithmetic!(unified_op1, unified_op2, /, checked_div, InterpretError::DivisionByZero) |
| 357 | } |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | pub fn rem_constants(op1: Constant, op2: Constant) -> Option<Constant> { |
| 362 | let (unified_op1, unified_op2) = unify_ops_type(op1, op2)?; |
| 363 | match &unified_op1 { |
| 364 | Constant::Instance { class_name, .. } |
no test coverage detected