-
Notifications
You must be signed in to change notification settings - Fork 105
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use a runtime-rng feature flag instead of using OS detection (#82) * Use cfg-if to simplify conditions * Require rng for RandomState::default and new. * Don't use runtime rng when fuzzing * Add support for hash_one Signed-off-by: Tom Kaitchuck <Tom.Kaitchuck@gmail.com> Co-authored-by: Amanieu d'Antras <amanieu@gmail.com> Co-authored-by: bl-ue <54780737+bl-ue@users.noreply.github.com>
- Loading branch information
1 parent
76dd8d2
commit 24491f6
Showing
14 changed files
with
417 additions
and
330 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,12 @@ | ||
#![feature(build_hasher_simple_hash_one)] | ||
|
||
use ahash::*; | ||
use core::slice; | ||
use std::hash::{BuildHasher, Hasher}; | ||
use std::hash::{BuildHasher}; | ||
|
||
#[no_mangle] | ||
pub extern "C" fn ahash64(buf: *const (), len: usize, seed: u64) -> u64 { | ||
let buf: &[u8] = unsafe { slice::from_raw_parts(buf as *const u8, len) }; | ||
let build_hasher = RandomState::with_seeds(seed, 0, 0, 0); | ||
<[u8]>::get_hash(&buf, &build_hasher) | ||
let build_hasher = RandomState::with_seed(seed as usize); | ||
build_hasher.hash_one(&buf) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.