Skip to content

Commit

Permalink
Merge pull request #1431 from MichaelOwenDyer/put-x86-macro-behind-x8…
Browse files Browse the repository at this point in the history
…6-config

Put macro `x86_intrinsic_impl` behind x86 configuration
  • Loading branch information
MichaelOwenDyer committed Apr 4, 2024
2 parents 2f6fee9 + 2f14aec commit 21a1ce1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/distributions/integer.rs
Expand Up @@ -23,7 +23,6 @@ use core::num::{
NonZeroI16, NonZeroI32, NonZeroI64, NonZeroI8, NonZeroIsize,NonZeroI128
};
#[cfg(feature = "simd_support")] use core::simd::*;
use core::mem;

impl Distribution<u8> for Standard {
#[inline]
Expand Down Expand Up @@ -123,6 +122,7 @@ impl_nzint!(NonZeroI64, NonZeroI64::new);
impl_nzint!(NonZeroI128, NonZeroI128::new);
impl_nzint!(NonZeroIsize, NonZeroIsize::new);

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

0 comments on commit 21a1ce1

Please sign in to comment.