MCPcopy Create free account
hub / github.com/davidblewett/rure-python / hash

Method hash

regex/src/compile.rs:997–1006  ·  view source on GitHub ↗
(&self, suffix: &SuffixCacheKey)

Source from the content-addressed store, hash-verified

995 }
996
997 fn hash(&self, suffix: &SuffixCacheKey) -> usize {
998 // Basic FNV-1a hash as described:
999 // https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function
1000 const FNV_PRIME: u64 = 1099511628211;
1001 let mut h = 14695981039346656037;
1002 h = (h ^ (suffix.from_inst as u64)).wrapping_mul(FNV_PRIME);
1003 h = (h ^ (suffix.start as u64)).wrapping_mul(FNV_PRIME);
1004 h = (h ^ (suffix.end as u64)).wrapping_mul(FNV_PRIME);
1005 (h as usize) % self.sparse.len()
1006 }
1007}
1008
1009struct ByteClassSet([bool; 256]);

Callers 1

getMethod · 0.80

Calls 1

lenMethod · 0.45

Tested by

no test coverage detected