And computes the logical AND of two bit arrays. The caller must ensure they have the same bit size.
(lhs, rhs BitArray)
| 432 | // And computes the logical AND of two bit arrays. |
| 433 | // The caller must ensure they have the same bit size. |
| 434 | func And(lhs, rhs BitArray) BitArray { |
| 435 | res := lhs.Clone() |
| 436 | for i, w := range rhs.words { |
| 437 | res.words[i] &= w |
| 438 | } |
| 439 | return res |
| 440 | } |
| 441 | |
| 442 | // Or computes the logical OR of two bit arrays. |
| 443 | // The caller must ensure they have the same bit size. |