Skip to content

Commit cf1b1bf

Browse files
committed
Promote constants.
1 parent 39dc1e8 commit cf1b1bf

File tree

1 file changed

+5
-2
lines changed
  • crates/processing_render/src/geometry

1 file changed

+5
-2
lines changed

crates/processing_render/src/geometry/layout.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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+
1013
pub 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

0 commit comments

Comments
 (0)