Skip to content

Commit

Permalink
Remove stdsimd requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
ogxd committed Nov 19, 2023
1 parent acbb0ab commit 70efdee
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ hashset.insert("hello world");
## Compatibility
- ARM 64-bit using `NEON` intrinsics.
- x86-64 bit using `SSE2` + `AES` intrinsics.
- (optional) with `avx2` feature enabled, gxhash will use `AVX2` intrinsics, for up to twice as much performance for large inputs. Only compatible on `AVX2` enabled x86-64 platforms.
- (optional and only on unstable toolchain) with `avx2` feature enabled, gxhash will use `AVX2` intrinsics, for up to twice as much performance for large inputs. Only compatible on `AVX2` enabled x86-64 platforms.

> **Warning**
> Other platforms are currently not supported (there is no fallback)
Expand Down
2 changes: 1 addition & 1 deletion src/gxhash/platform/x86_128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub unsafe fn get_partial_safe(data: *const State, len: usize) -> State {
// Copy data into the buffer
std::ptr::copy(data as *const i8, buffer.as_mut_ptr(), len);
// Load the buffer into a __m256i vector
let partial_vector = _mm_loadu_epi8(buffer.as_ptr());
let partial_vector = _mm_loadu_si128(buffer.as_ptr() as *const State);
_mm_add_epi8(partial_vector, _mm_set1_epi8(len as i8))
}

Expand Down
2 changes: 1 addition & 1 deletion src/gxhash/platform/x86_256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ pub unsafe fn get_partial_safe(data: *const State, len: usize) -> State {
// Copy data into the buffer
std::ptr::copy(data as *const i8, buffer.as_mut_ptr(), len);
// Load the buffer into a __m256i vector
let partial_vector = _mm256_loadu_epi8(buffer.as_ptr());
let partial_vector = _mm256_loadu_si256(buffer.as_ptr() as *const State);
_mm256_add_epi8(partial_vector, _mm256_set1_epi8(len as i8))
}

Expand Down
6 changes: 2 additions & 4 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
//#![feature(core_intrinsics)]
//#![feature(pointer_byte_offsets)]
#![feature(stdsimd)]
//#![feature(stmt_expr_attributes)]
// Feature 'avx2' currently requires unstable 'stdsimd'
#![cfg_attr(all(feature = "avx2", target_arch = "x86_64"), feature(stdsimd))]

mod gxhash;
mod hasher;
Expand Down

0 comments on commit 70efdee

Please sign in to comment.