fn evaluate_binary_int_op_arith<T: WrappingAdd + WrappingSub + WrappingMul + CheckedDiv + BitAnd<Output = T> + BitOr<Output = T> + BitXor<Output = T>>(
op: &BinaryIntOp,
lhs: T,
rhs: T,
) -> Result<T, BrilligArithmeticError>
Expand description
Evaluates arithmetic or bitwise operations on unsigned integer types, using wrapping arithmetic for add, sub, and mul.
§Returns
- Ok(result) if successful.
- Err(BrilligArithmeticError::DivisionByZero) if division by zero occurs.
§Panics
If there an operation other than Add, Sub, Mul, Div, And, Or, Xor is supplied as an argument.