(
packed_histogram: &[usize; FACTOR_POW_DIVISOR],
)
| 349 | |
| 350 | #[inline(never)] |
| 351 | fn unpack_histogram<const FACTOR: usize, const FACTOR_POW_DIVISOR: usize>( |
| 352 | packed_histogram: &[usize; FACTOR_POW_DIVISOR], |
| 353 | ) -> [usize; FACTOR] { |
| 354 | let divisor = factor_to_divisor::<FACTOR>(); |
| 355 | assert_eq!(FACTOR.pow(divisor as u32), FACTOR_POW_DIVISOR); |
| 356 | std::array::from_fn(|i| { |
| 357 | let mut sum = 0; |
| 358 | for level in 0..divisor { |
| 359 | let width = FACTOR.pow(level as u32); |
| 360 | let runs = FACTOR_POW_DIVISOR / (width * FACTOR); |
| 361 | for run in 0..runs { |
| 362 | let run_start = run * (width * FACTOR) + i * width; |
| 363 | let section = &packed_histogram[run_start..run_start + width]; |
| 364 | sum += section.iter().copied().sum::<usize>(); |
| 365 | } |
| 366 | } |
| 367 | sum |
| 368 | }) |
| 369 | } |
| 370 | |
| 371 | #[inline(always)] |
| 372 | fn factor_to_divisor<const FACTOR: usize>() -> usize { |
no outgoing calls
no test coverage detected