Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions src/distr/integer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -159,10 +159,7 @@ macro_rules! simd_impl {
///
/// [`simd_support`]: https://github.com/rust-random/rand#crate-features
#[cfg(feature = "simd_support")]
impl<const LANES: usize> Distribution<Simd<$ty, LANES>> for StandardUniform
where
LaneCount<LANES>: SupportedLaneCount,
{
impl<const LANES: usize> Distribution<Simd<$ty, LANES>> for StandardUniform {
#[inline]
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Simd<$ty, LANES> {
let mut vec = Simd::default();
Expand Down
5 changes: 2 additions & 3 deletions src/distr/other.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ use crate::distr::{Distribution, StandardUniform, Uniform};
use crate::{Rng, RngExt};

#[cfg(feature = "simd_support")]
use core::simd::prelude::*;
use core::simd::MaskElement;
#[cfg(feature = "simd_support")]
use core::simd::{LaneCount, MaskElement, SupportedLaneCount};
use core::simd::prelude::*;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};

Expand Down Expand Up @@ -234,7 +234,6 @@ impl Distribution<bool> for StandardUniform {
impl<T, const LANES: usize> Distribution<Mask<T, LANES>> for StandardUniform
where
T: MaskElement + Default,
LaneCount<LANES>: SupportedLaneCount,
StandardUniform: Distribution<Simd<T, LANES>>,
Simd<T, LANES>: SimdPartialOrd<Mask = Mask<T, LANES>>,
{
Expand Down
2 changes: 0 additions & 2 deletions src/distr/uniform_float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ use crate::{Rng, RngExt};

#[cfg(feature = "simd_support")]
use core::simd::prelude::*;
// #[cfg(feature = "simd_support")]
// use core::simd::{LaneCount, SupportedLaneCount};

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
Expand Down
6 changes: 1 addition & 5 deletions src/distr/uniform_int.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use crate::distr::{Distribution, StandardUniform};
use crate::{Rng, RngExt};

#[cfg(feature = "simd_support")]
use core::simd::prelude::*;
#[cfg(feature = "simd_support")]
use core::simd::{LaneCount, SupportedLaneCount};
use core::simd::{Select, prelude::*};

#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -283,7 +281,6 @@ macro_rules! uniform_simd_int_impl {
#[cfg(feature = "simd_support")]
impl<const LANES: usize> SampleUniform for Simd<$ty, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
Simd<$unsigned, LANES>:
WideningMultiply<Output = (Simd<$unsigned, LANES>, Simd<$unsigned, LANES>)>,
StandardUniform: Distribution<Simd<$unsigned, LANES>>,
Expand All @@ -294,7 +291,6 @@ macro_rules! uniform_simd_int_impl {
#[cfg(feature = "simd_support")]
impl<const LANES: usize> UniformSampler for UniformInt<Simd<$ty, LANES>>
where
LaneCount<LANES>: SupportedLaneCount,
Simd<$unsigned, LANES>:
WideningMultiply<Output = (Simd<$unsigned, LANES>, Simd<$unsigned, LANES>)>,
StandardUniform: Distribution<Simd<$unsigned, LANES>>,
Expand Down
16 changes: 5 additions & 11 deletions src/distr/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
//! Math helper functions

#[cfg(feature = "simd_support")]
use core::simd::prelude::*;
use core::simd::SimdElement;
#[cfg(feature = "simd_support")]
use core::simd::{LaneCount, SimdElement, SupportedLaneCount};
use core::simd::prelude::*;

pub(crate) trait WideningMultiply<RHS = Self> {
type Output;
Expand Down Expand Up @@ -337,10 +337,7 @@ scalar_float_impl!(f64, u64);
#[cfg(feature = "simd_support")]
macro_rules! simd_impl {
($fty:ident, $uty:ident) => {
impl<const LANES: usize> FloatSIMDUtils for Simd<$fty, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
{
impl<const LANES: usize> FloatSIMDUtils for Simd<$fty, LANES> {
type Mask = Mask<<$fty as SimdElement>::Mask, LANES>;
type UInt = Simd<$uty, LANES>;

Expand Down Expand Up @@ -373,7 +370,7 @@ macro_rules! simd_impl {
// value representable by $fty. This works even when the
// current value is infinity.
debug_assert!(mask.any(), "At least one lane must be set");
Self::from_bits(self.to_bits() + mask.to_int().cast())
Self::from_bits(self.to_bits() + mask.to_simd().cast())
}

#[inline]
Expand All @@ -383,10 +380,7 @@ macro_rules! simd_impl {
}

#[cfg(test)]
impl<const LANES: usize> FloatSIMDScalarUtils for Simd<$fty, LANES>
where
LaneCount<LANES>: SupportedLaneCount,
{
impl<const LANES: usize> FloatSIMDScalarUtils for Simd<$fty, LANES> {
type Scalar = $fty;

#[inline]
Expand Down