Xor computes the logical XOR of two bit arrays. The caller must ensure they have the same bit size.
(lhs, rhs BitArray)
| 438 | // Xor computes the logical XOR of two bit arrays. |
| 439 | // The caller must ensure they have the same bit size. |
| 440 | func Xor(lhs, rhs BitArray) BitArray { |
| 441 | res := lhs.Clone() |
| 442 | for i, w := range rhs.words { |
| 443 | res.words[i] ^= w |
| 444 | } |
| 445 | return res |
| 446 | } |
| 447 | |
| 448 | // Compare compares two bit arrays. They can have mixed sizes. |
| 449 | func Compare(lhs, rhs BitArray) int { |