(bytes: &[u8])
| 15 | } |
| 16 | |
| 17 | fn histogram_parallel(bytes: &[u8]) -> [usize; 256] { |
| 18 | // Summing multiple 32 bit histograms is faster than a 64 bit histogram. |
| 19 | let mut total = [0; 256]; |
| 20 | for bytes in bytes.chunks(u32::MAX as usize) { |
| 21 | for (i, &v) in histogram_parallel_u32(bytes).iter().enumerate() { |
| 22 | total[i] += v as usize; |
| 23 | } |
| 24 | } |
| 25 | total |
| 26 | } |
| 27 | |
| 28 | // Based on https://github.com/facebook/zstd/blob/1518570c62b95136b6a69714012957cae5487a9a/lib/compress/hist.c#L66 |
| 29 | fn histogram_parallel_u32(bytes: &[u8]) -> [u32; 256] { |
no test coverage detected