FNV-1a hash for raw bytes (used by approx aggregates to feed HLL/SpaceSaving).
(bytes: &[u8])
| 412 | |
| 413 | /// FNV-1a hash for raw bytes (used by approx aggregates to feed HLL/SpaceSaving). |
| 414 | fn hash_bytes(bytes: &[u8]) -> u64 { |
| 415 | let mut h: u64 = 0xcbf29ce484222325; |
| 416 | for &b in bytes { |
| 417 | h ^= b as u64; |
| 418 | h = h.wrapping_mul(0x100000001b3); |
| 419 | } |
| 420 | h |
| 421 | } |
| 422 | |
| 423 | #[cfg(test)] |
| 424 | mod tests { |
no outgoing calls
no test coverage detected