MCPcopy Create free account
hub / github.com/IntegralPilot/rustc_codegen_jvm / add_constants

Function add_constants

src/oomir/interpret.rs:346–361  ·  view source on GitHub ↗
(op1: Constant, op2: Constant)

Source from the content-addressed store, hash-verified

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
361pub 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, .. }

Callers 1

Calls 5

unify_ops_typeFunction · 0.85
parse_constant_to_bigintFunction · 0.85
bigint_to_constantFunction · 0.85
bigdecimal_to_constantFunction · 0.85

Tested by

no test coverage detected