Function bitwise

Source
fn bitwise<Op>(out_vec: &mut [u64], in_vec: &[u64], op: Op) -> bool
where Op: Fn(u64, u64) -> u64,
Expand description

Sets out_vec[i] = op(out_vec[i], in_vec[i]) for each index i in both slices. The slices must have the same length.

Returns true if at least one bit in out_vec was changed.

§Warning

Some bitwise operations (e.g. union-not, xor) can set output bits that were unset in in both inputs. If this happens in the last word/chunk of a bitset, it can cause the bitset to contain out-of-domain values, which need to be cleared with clear_excess_bits_in_final_word. This also makes the “changed” return value unreliable, because the change might have only affected excess bits.