Skip to content

Commit

Permalink
Remove dependency on packed_simd by using SIMD intrinsics.
Browse files Browse the repository at this point in the history
The resulting code is a little ugly, but not too bad.

This allows the crate to compile on stable.
  • Loading branch information
goffrie committed Nov 3, 2020
1 parent 63004bd commit 3f3b268
Show file tree
Hide file tree
Showing 8 changed files with 246 additions and 223 deletions.
17 changes: 0 additions & 17 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion Cargo.toml
Expand Up @@ -17,7 +17,6 @@ exclude = [

[dependencies]
arrayref = "0.3.6"
packed_simd = { version = "0.3.4", package = "packed_simd_2" }

[dev-dependencies]
librsync = { git = "https://github.com/goffrie/librsync-rs", rev = "56e7646d133c3174656b66c61f6259d6154a8873", default-features = false }
Expand Down
4 changes: 1 addition & 3 deletions README.md
Expand Up @@ -9,9 +9,7 @@ A faster implementation of [librsync](https://github.com/librsync/librsync) in
pure Rust, using SIMD operations where available. Note that only the legacy MD4
format is supported, not BLAKE2.

Rust nightly is currently required because of
[packed\_simd](https://github.com/rust-lang/packed_simd). Only x86 and x86-64
architectures are currently supported.
Only x86 and x86-64 architectures are currently supported for SIMD.

## The rsync algorithm
This crate offers three major APIs:
Expand Down
12 changes: 1 addition & 11 deletions fuzz/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion rust-toolchain
@@ -1 +1 @@
nightly-2020-10-13
1.47.0
8 changes: 6 additions & 2 deletions src/crc.rs
Expand Up @@ -71,11 +71,15 @@ impl Crc {
{
if is_x86_feature_detected!("avx2") {
imp!(#[target_feature(enable = "avx2")] unsafe fn imp_avx2);
unsafe { return imp_avx2(self, buf); }
unsafe {
return imp_avx2(self, buf);
}
}
if is_x86_feature_detected!("sse2") {
imp!(#[target_feature(enable = "sse2")] unsafe fn imp_sse2);
unsafe { return imp_sse2(self, buf); }
unsafe {
return imp_sse2(self, buf);
}
}
}
imp!(fn imp_baseline);
Expand Down

0 comments on commit 3f3b268

Please sign in to comment.