Returns `Ok(histogram)` if buckets after `OUT` are 0.
(
histogram: [usize; IN],
)
| 229 | |
| 230 | /// Returns `Ok(histogram)` if buckets after `OUT` are 0. |
| 231 | fn check_histogram<const IN: usize, const OUT: usize>( |
| 232 | histogram: [usize; IN], |
| 233 | ) -> Result<[usize; OUT]> { |
| 234 | let (histogram, remaining) = histogram.split_at(OUT); |
| 235 | if remaining.iter().copied().sum::<usize>() != 0 { |
| 236 | return invalid_packing(); |
| 237 | } |
| 238 | Ok(*<&[usize; OUT]>::try_from(histogram).unwrap()) |
| 239 | } |
| 240 | |
| 241 | let p = Packing::new(N.saturating_sub(1) as u8); |
| 242 | if p == Packing::_256 { |
no test coverage detected