Skip to content

Commit 21a1ce1

Browse files
Merge pull request #1431 from MichaelOwenDyer/put-x86-macro-behind-x86-config
Put macro `x86_intrinsic_impl` behind x86 configuration
2 parents 2f6fee9 + 2f14aec commit 21a1ce1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/distributions/integer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ use core::num::{
2323
NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize,NonZeroI128
2424
};
2525
#[cfg(feature = "simd_support")] use core::simd::*;
26-
use core::mem;
2726

2827
impl Distribution<u8> for Standard {
2928
#[inline]
@@ -123,6 +122,7 @@ impl_nzint!(NonZeroI64, NonZeroI64::new);
123122
impl_nzint!(NonZeroI128, NonZeroI128::new);
124123
impl_nzint!(NonZeroIsize, NonZeroIsize::new);
125124

125+
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
126126
macro_rules! x86_intrinsic_impl {
127127
($meta:meta, $($intrinsic:ident),+) => {$(
128128
#[cfg($meta)]
@@ -132,7 +132,7 @@ macro_rules! x86_intrinsic_impl {
132132
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> $intrinsic {
133133
// On proper hardware, this should compile to SIMD instructions
134134
// Verified on x86 Haswell with __m128i, __m256i
135-
let mut buf = [0_u8; mem::size_of::<$intrinsic>()];
135+
let mut buf = [0_u8; core::mem::size_of::<$intrinsic>()];
136136
rng.fill_bytes(&mut buf);
137137
// x86 is little endian so no need for conversion
138138
zerocopy::transmute!(buf)

0 commit comments

Comments
 (0)