Function bitwise_op

Source
fn bitwise_op<F: AcirField>(
    lhs: F,
    rhs: F,
    num_bits: u32,
    op: fn(u8, u8) -> u8,
) -> F
Expand description

Performs a bitwise operation on two field elements by treating them as byte arrays.

Both field elements are converted to little-endian byte arrays and masked to keep only the lowest num_bits bits. The provided operation op is then applied byte-by-byte, and the result is converted back to a field element. This function works for any num_bits value and does not assume it to be a multiple of 8.