Returns whether there is at least one `true` value in this buffer. This is more efficient than `count_set_bits() > 0` because it can short-circuit as soon as a `true` value is found, without counting all set bits. Returns `false` for empty buffer.
(&self)
| 643 | /// |
| 644 | /// Returns `false` for empty buffer. |
| 645 | pub fn has_true(&self) -> bool { |
| 646 | let bit_chunks = self.unaligned_bit_chunks(); |
| 647 | let chunks = bit_chunks.chunks(); |
| 648 | let mut exact = chunks.chunks_exact(Self::CHUNK_FOLD_BLOCK_SIZE); |
| 649 | let found = bit_chunks.prefix().unwrap_or(0) != 0 |
| 650 | || exact.any(|block| block.iter().fold(0u64, |acc, &c| acc | c) != 0); |
| 651 | found || exact.remainder().iter().any(|&c| c != 0) || bit_chunks.suffix().unwrap_or(0) != 0 |
| 652 | } |
| 653 | |
| 654 | /// Returns whether there is at least one `false` value in this buffer. |
| 655 | /// |
nothing calls this directly
no test coverage detected