Function malachite_base::slices::slice_test_zero
source · pub fn slice_test_zero<T: Eq + Zero>(xs: &[T]) -> bool
Expand description
Tests whether all values in a slice are equal to 0.
§Worst-case complexity
$T(n) = O(n)$
$M(n) = O(1)$
where $T$ is time, $M$ is additional memory, and $n$ is xs.len()
.
§Examples
use malachite_base::slices::slice_test_zero;
assert!(slice_test_zero::<u32>(&[0, 0, 0]));
assert!(!slice_test_zero::<u32>(&[0, 1, 0]));
This is equivalent to mpn_zero_p
from gmp-h.in
, GMP 6.2.1.