diff --git a/src/f32x4_.rs b/src/f32x4_.rs index 8a94c543..cb348172 100644 --- a/src/f32x4_.rs +++ b/src/f32x4_.rs @@ -628,13 +628,14 @@ impl f32x4 { mask.blend(self, f) } else if #[cfg(target_feature="simd128")] { Self { simd: f32x4_nearest(self.simd) } - } else if #[cfg(feature="std")] { - Self { arr: [ - self.arr[0].round(), - self.arr[1].round(), - self.arr[2].round(), - self.arr[3].round(), - ]} + } else if #[cfg(all(feature="std", not(target_arch="wasm32")))] { + let data = self.to_array(); + Self::new([ + data[0].round(), + data[1].round(), + data[2].round(), + data[3].round(), + ]) } else { // Note(Lokathor): This software fallback is probably very slow compared // to having a hardware option available, even just the sse2 version is diff --git a/src/f32x8_.rs b/src/f32x8_.rs index 50afac27..84e4288d 100644 --- a/src/f32x8_.rs +++ b/src/f32x8_.rs @@ -750,17 +750,18 @@ impl f32x8 { Self { sse0: round_m128::<{round_op!(Nearest)}>(self.sse0), sse1: round_m128::<{round_op!(Nearest)}>(self.sse1) } } else if #[cfg(target_feature="simd128")] { Self { simd0: f32x4_nearest(self.simd0), simd1: f32x4_nearest(self.simd1) } - } else if #[cfg(feature="std")] { - Self { arr: [ - self.arr[0].round(), - self.arr[1].round(), - self.arr[2].round(), - self.arr[3].round(), - self.arr[4].round(), - self.arr[5].round(), - self.arr[6].round(), - self.arr[7].round(), - ]} + } else if #[cfg(all(feature="std", not(target_arch="wasm32")))] { + let data = self.to_array(); + Self::new([ + data[0].round(), + data[1].round(), + data[2].round(), + data[3].round(), + data[4].round(), + data[5].round(), + data[6].round(), + data[7].round(), + ]) } else { // Note(Lokathor): This software fallback is probably very slow compared // to having a hardware option available, even just the sse2 version is diff --git a/src/f64x2_.rs b/src/f64x2_.rs index d3ffe0b1..3284b7ea 100644 --- a/src/f64x2_.rs +++ b/src/f64x2_.rs @@ -588,11 +588,12 @@ impl f64x2 { Self { sse: round_m128d::<{round_op!(Nearest)}>(self.sse) } } else if #[cfg(target_feature="simd128")] { Self { simd: f64x2_nearest(self.simd) } - } else if #[cfg(feature="std")] { - Self { arr: [ - self.arr[0].round(), - self.arr[1].round(), - ]} + } else if #[cfg(all(feature="std", not(target_arch="wasm32")))] { + let data = self.to_array(); + Self::new([ + data[0].round(), + data[1].round(), + ]) } else { let sign_mask = f64x2::from(-0.0); let magic = f64x2::from(f64::from_bits(0x43300000_00000000)); diff --git a/src/f64x4_.rs b/src/f64x4_.rs index ad53b646..1f3908e9 100644 --- a/src/f64x4_.rs +++ b/src/f64x4_.rs @@ -682,13 +682,14 @@ impl f64x4 { Self { sse0: round_m128d::<{round_op!(Nearest)}>(self.sse0), sse1: round_m128d::<{round_op!(Nearest)}>(self.sse1) } } else if #[cfg(target_feature="simd128")] { Self { simd0: f64x2_nearest(self.simd0), simd1: f64x2_nearest(self.simd1) } - } else if #[cfg(feature="std")] { - Self { arr: [ - self.arr[0].round(), - self.arr[1].round(), - self.arr[2].round(), - self.arr[3].round(), - ]} + } else if #[cfg(all(feature="std", not(target_arch="wasm32")))] { + let data = self.to_array(); + Self::new([ + data[0].round(), + data[1].round(), + data[2].round(), + data[3].round(), + ]) } else { let sign_mask = f64x4::from(-0.0); let magic = f64x4::from(f64::from_bits(0x43300000_00000000));