MCPcopy Create free account
hub / github.com/atomicdotdev/atomic / hash_line

Function hash_line

atomic-core/src/record/workflow/recipes/content_hash.rs:26–35  ·  view source on GitHub ↗
(bytes: &[u8])

Source from the content-addressed store, hash-verified

24/// need to compute and compare hashes outside the index abstraction.
25#[inline]
26pub fn hash_line(bytes: &[u8]) -> u64 {
27 const FNV_OFFSET: u64 = 0xcbf2_9ce4_8422_2325;
28 const FNV_PRIME: u64 = 0x0000_0100_0000_01b3;
29 let mut h = FNV_OFFSET;
30 for &b in bytes {
31 h ^= b as u64;
32 h = h.wrapping_mul(FNV_PRIME);
33 }
34 h
35}
36
37/// Index of line content → positions where that content appears.
38///

Callers 5

insertMethod · 0.85
candidatesMethod · 0.85
consumeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected