Module arithmetic

Source
Expand description

Implementations for [binary field operations][acir::brillig::Opcode::BinaryFieldOp] and [binary integer operations][acir::brillig::Opcode::BinaryIntOp].

Enumsยง

BrilligArithmeticError ๐Ÿ”’

Functionsยง

evaluate_binary_field_op ๐Ÿ”’
Evaluate a binary operation on two FieldElement memory values.
evaluate_binary_int_op ๐Ÿ”’
Evaluate a binary operation on two unsigned big integers with a given bit size.
evaluate_binary_int_op_arith ๐Ÿ”’
Evaluates arithmetic or bitwise operations on unsigned integer types, using wrapping arithmetic for [add][BinaryIntOp::Add], [sub][BinaryIntOp::Sub], and [mul][BinaryIntOp::Mul].
evaluate_binary_int_op_cmp ๐Ÿ”’
Evaluates comparison operations (Equals, LessThan, LessThanEquals) between two values of an ordered type (e.g., fields are unordered).
evaluate_binary_int_op_shifts ๐Ÿ”’
Evaluates shift operations (Shl, Shr) for unsigned integers. Ensures that shifting beyond the type width returns zero.
evaluate_binary_int_op_u1 ๐Ÿ”’
Evaluates binary operations on 1-bit unsigned integers (booleans).