Function evaluate_binary_int_op_shifts

Source
fn evaluate_binary_int_op_shifts<T: ToPrimitive + Zero + Shl<Output = T> + Shr<Output = T>>(
    op: &BinaryIntOp,
    lhs: T,
    rhs: T,
) -> Result<T, BrilligArithmeticError>
Expand description

Evaluates shift operations (Shl, Shr) for unsigned integers. Ensures that shifting beyond the type width returns zero.

§Returns

  • Ok(result)

§Panics

If an unsupported operator is provided (i.e., not Shl or Shr).