Skip to content

Commit 5f6ad92

Browse files
committed
Update phf to 0.8
1 parent d56ba88 commit 5f6ad92

File tree

4 files changed

+8
-7
lines changed

4 files changed

+8
-7
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ unstable = []
2525
precomputed-hash = "0.1"
2626
lazy_static = "1"
2727
serde = "1"
28-
phf_shared = "0.7.4"
28+
phf_shared = "0.8"
2929
new_debug_unreachable = "1.0"
3030
string_cache_shared = {path = "./shared", version = "0.3"}
3131

src/atom.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -324,8 +324,8 @@ impl<'a, Static: StaticAtomSet> From<Cow<'a, str>> for Atom<Static> {
324324
#[inline]
325325
fn from(string_to_add: Cow<'a, str>) -> Self {
326326
let static_set = Static::get();
327-
let hash = phf_shared::hash(&*string_to_add, static_set.key);
328-
let index = phf_shared::get_index(hash, static_set.disps, static_set.atoms.len());
327+
let hash = phf_shared::hash(&*string_to_add, &static_set.key);
328+
let index = phf_shared::get_index(&hash, static_set.disps, static_set.atoms.len());
329329

330330
let unpacked = if static_set.atoms[index as usize] == string_to_add {
331331
Static(index)
@@ -336,6 +336,7 @@ impl<'a, Static: StaticAtomSet> From<Cow<'a, str>> for Atom<Static> {
336336
buf[..len].copy_from_slice(string_to_add.as_bytes());
337337
Inline(len as u8, buf)
338338
} else {
339+
let hash = (hash.g as u64) << 32 | (hash.f1 as u64);
339340
Dynamic(STRING_CACHE.lock().unwrap().add(string_to_add, hash) as *mut ())
340341
}
341342
};

string-cache-codegen/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ path = "lib.rs"
1414

1515
[dependencies]
1616
string_cache_shared = {path = "../shared", version = "0.3"}
17-
phf_generator = "0.7.22"
18-
phf_shared = "0.7.4"
17+
phf_generator = "0.8"
18+
phf_shared = "0.8"
1919
proc-macro2 = "1"
2020
quote = "1"

string-cache-codegen/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,8 +203,8 @@ impl AtomType {
203203

204204
let hashes: Vec<u32> =
205205
atoms.iter().map(|string| {
206-
let hash = phf_shared::hash(string, key);
207-
((hash >> 32) ^ hash) as u32
206+
let hash = phf_shared::hash(string, &key);
207+
(hash.g ^ hash.f1) as u32
208208
}).collect();
209209

210210
let type_name = if let Some(position) = self.path.rfind("::") {

0 commit comments

Comments
 (0)