Modify hashing function.

This commit is contained in:
Stephen Chung 2023-02-24 14:24:10 +08:00
parent 5b200a6d3d
commit c2a8c342bb

View File

@ -86,7 +86,7 @@ pub fn calc_var_hash<'a>(namespace: impl IntoIterator<Item = &'a str>, var_name:
}
count += 1;
});
count.hash(s);
s.write_usize(count);
var_name.hash(s);
s.finish()
@ -120,9 +120,9 @@ pub fn calc_fn_hash<'a>(
}
count += 1;
});
count.hash(s);
s.write_usize(count);
fn_name.hash(s);
num.hash(s);
s.write_usize(num);
s.finish()
}
@ -134,13 +134,12 @@ pub fn calc_fn_hash<'a>(
#[must_use]
pub fn calc_fn_hash_full(base: u64, params: impl IntoIterator<Item = TypeId>) -> u64 {
let s = &mut get_hasher();
base.hash(s);
let mut count = 0;
params.into_iter().for_each(|t| {
t.hash(s);
count += 1;
});
count.hash(s);
s.write_usize(count);
s.finish()
s.finish() ^ base
}