Skip to content

Commit

Permalink
Use BuildHasher::hash_one (#8677)
Browse files Browse the repository at this point in the history
  • Loading branch information
scottmcm authored May 22, 2024
1 parent 3eae74d commit ac743dd
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions cranelift/src/souper_harvest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use cranelift_codegen::Context;
use cranelift_reader::parse_sets_and_triple;
use rayon::iter::{IntoParallelIterator, ParallelBridge, ParallelIterator};
use std::collections::HashSet;
use std::hash::{BuildHasher, BuildHasherDefault};
use std::io::Write;
use std::path::PathBuf;
use std::{fs, io};
Expand Down Expand Up @@ -143,7 +144,5 @@ fn parse_input(path: PathBuf) -> Result<Vec<Function>> {
/// A convenience function for a quick usize hash
#[inline]
pub fn hash<T: std::hash::Hash + ?Sized>(v: &T) -> usize {
let mut state = rustc_hash::FxHasher::default();
v.hash(&mut state);
std::hash::Hasher::finish(&state) as usize
BuildHasherDefault::<rustc_hash::FxHasher>::default().hash_one(v) as usize
}

0 comments on commit ac743dd

Please sign in to comment.