File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
crates/processing_render/src/geometry Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -7,13 +7,16 @@ use crate::error::{ProcessingError, Result};
77// expose this to users, so we hash the attribute name to generate a unique id. in theory
88// there could be collisions, but in practice this should be fine?
99// https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function#FNV-1a_hash
10+ const FNV1A_OFFSET_BASIS : u64 = 0xcbf29ce484222325 ;
11+ const FNV1A_PRIME : u64 = 0x100000001b3 ;
12+
1013pub const fn hash_attr_name ( s : & str ) -> u64 {
1114 let bytes = s. as_bytes ( ) ;
12- let mut hash = 0xcbf29ce484222325u64 ;
15+ let mut hash = FNV1A_OFFSET_BASIS ;
1316 let mut i = 0 ;
1417 while i < bytes. len ( ) {
1518 hash ^= bytes[ i] as u64 ;
16- hash = hash. wrapping_mul ( 0x100000001b3 ) ;
19+ hash = hash. wrapping_mul ( FNV1A_PRIME ) ;
1720 i += 1 ;
1821 }
1922 hash
You can’t perform that action at this time.
0 commit comments