alternative to packaged_simd, as coverage does not compile withit, and it was left out in the simd feature

This commit is contained in:
Marcel Märtens 2021-07-14 10:55:11 +02:00
parent 117035f47b
commit 9a2c2b300a
2 changed files with 17 additions and 3 deletions

View File

@ -5,7 +5,7 @@ authors = ["Joshua Barretto <joshua.s.barretto@gmail.com>"]
edition = "2018"
[features]
simd = ["vek/platform_intrinsics"]
simd = ["vek/platform_intrinsics", "packed_simd"]
bin_compression = ["lz-fear", "deflate", "flate2", "image/jpeg", "num-traits", "fallible-iterator", "kiddo", "clap", "rstar"]
default = ["simd"]
@ -31,7 +31,7 @@ tracing = { version = "0.1", default-features = false }
rand = "0.8"
rand_chacha = "0.3"
arr_macro = "0.1.2"
packed_simd = { package = "packed_simd_2", version = "0.3.5" }
packed_simd = { package = "packed_simd_2", version = "0.3.5", optional = true }
rayon = "1.5"
serde = { version = "1.0.110", features = ["derive"] }
ron = { version = "0.6", default-features = false }

View File

@ -13,7 +13,7 @@ use itertools::izip;
use noise::NoiseFn;
use num::{Float, Zero};
use ordered_float::NotNan;
use packed_simd::m32;
#[cfg(feature = "simd")] use packed_simd::m32;
use rayon::prelude::*;
use std::{
cmp::{Ordering, Reverse},
@ -607,6 +607,20 @@ fn get_max_slope(
.into_boxed_slice()
}
//simd alternative
#[cfg(not(feature = "simd"))]
#[derive(Copy, Clone)]
#[allow(non_camel_case_types)]
struct m32(u32);
#[cfg(not(feature = "simd"))]
impl m32 {
#[inline]
fn new(x: bool) -> Self { if x { Self(u32::MAX) } else { Self(u32::MIN) } }
#[inline]
fn test(&self) -> bool { self.0 != 0 }
}
/// Erode all chunks by amount.
///
/// Our equation is: