openvm_bigint_guest

Macro impl_bin_op

Source
macro_rules! impl_bin_op {
    ($struct_name:ty, $trait_name:ident,
        $trait_assign_name:ident, $trait_fn:ident,
        $trait_assign_fn:ident, $opcode:expr,
        $func3:expr, $func7:expr, $op_sym:tt,
        $rust_expr:expr) => { ... };
}
Expand description

A macro that implements all the following for the given struct and operation: a op= b, a op= &b, a op b, a op &b, &a op b, &a op &b Description of the parameters (see [u256.rs] for an example):

  • $struct_name: The struct to implement the operation for.
  • $trait_name: The trait name of the operation to implement.
  • $trait_assign_name: The trait name of the assignment operation to implement.
  • $trait_fn: The trait function name to implement.
  • $trait_assign_fn: The assignment trait function name to implement.
  • $opcode: The custom opcode of the operation in openvm.
  • $func3: The func3 of the operation in openvm.
  • $func7: The func7 of the operation in openvm.
  • $op_sym: The symbol to use for the operation.
  • $rust_expr: A closure to get the result of the operation if target is non-zkvm.