Skip to content

Commit

Permalink
Only enable simd on targets which feature SSE
Browse files Browse the repository at this point in the history
  • Loading branch information
mkroening committed Oct 27, 2020
1 parent 10f11fb commit 40052ce
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ fn main() {
// This can be disabled with RUSTFLAGS="--cfg memchr_disable_auto_simd", but
// this is generally only intended for testing.
fn enable_simd_optimizations() {
if is_env_set("CARGO_CFG_MEMCHR_DISABLE_AUTO_SIMD") {
if is_env_set("CARGO_CFG_MEMCHR_DISABLE_AUTO_SIMD")
|| !env::var("CARGO_CFG_TARGET_FEATURE")
.map(|features| features.contains("sse"))
.unwrap_or(false)
{
return;
}
println!("cargo:rustc-cfg=memchr_runtime_simd");
Expand Down

0 comments on commit 40052ce

Please sign in to comment.