Skip to content

Commit eaf2bef

Browse files
authored
Update for SIMD changes (#1725)
2 parents a4c9a8e + c4967be commit eaf2bef

File tree

5 files changed

+9
-25
lines changed

5 files changed

+9
-25
lines changed

src/distr/integer.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,7 @@ macro_rules! simd_impl {
159159
///
160160
/// [`simd_support`]: https://github.com/rust-random/rand#crate-features
161161
#[cfg(feature = "simd_support")]
162-
impl<const LANES: usize> Distribution<Simd<$ty, LANES>> for StandardUniform
163-
where
164-
LaneCount<LANES>: SupportedLaneCount,
165-
{
162+
impl<const LANES: usize> Distribution<Simd<$ty, LANES>> for StandardUniform {
166163
#[inline]
167164
fn sample<R: Rng + ?Sized>(&self, rng: &mut R) -> Simd<$ty, LANES> {
168165
let mut vec = Simd::default();

src/distr/other.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ use crate::distr::{Distribution, StandardUniform, Uniform};
2020
use crate::{Rng, RngExt};
2121

2222
#[cfg(feature = "simd_support")]
23-
use core::simd::prelude::*;
23+
use core::simd::MaskElement;
2424
#[cfg(feature = "simd_support")]
25-
use core::simd::{LaneCount, MaskElement, SupportedLaneCount};
25+
use core::simd::prelude::*;
2626
#[cfg(feature = "serde")]
2727
use serde::{Deserialize, Serialize};
2828

@@ -234,7 +234,6 @@ impl Distribution<bool> for StandardUniform {
234234
impl<T, const LANES: usize> Distribution<Mask<T, LANES>> for StandardUniform
235235
where
236236
T: MaskElement + Default,
237-
LaneCount<LANES>: SupportedLaneCount,
238237
StandardUniform: Distribution<Simd<T, LANES>>,
239238
Simd<T, LANES>: SimdPartialOrd<Mask = Mask<T, LANES>>,
240239
{

src/distr/uniform_float.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ use crate::{Rng, RngExt};
1616

1717
#[cfg(feature = "simd_support")]
1818
use core::simd::prelude::*;
19-
// #[cfg(feature = "simd_support")]
20-
// use core::simd::{LaneCount, SupportedLaneCount};
2119

2220
#[cfg(feature = "serde")]
2321
use serde::{Deserialize, Serialize};

src/distr/uniform_int.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ use crate::distr::{Distribution, StandardUniform};
1616
use crate::{Rng, RngExt};
1717

1818
#[cfg(feature = "simd_support")]
19-
use core::simd::prelude::*;
20-
#[cfg(feature = "simd_support")]
21-
use core::simd::{LaneCount, SupportedLaneCount};
19+
use core::simd::{Select, prelude::*};
2220

2321
#[cfg(feature = "serde")]
2422
use serde::{Deserialize, Serialize};
@@ -283,7 +281,6 @@ macro_rules! uniform_simd_int_impl {
283281
#[cfg(feature = "simd_support")]
284282
impl<const LANES: usize> SampleUniform for Simd<$ty, LANES>
285283
where
286-
LaneCount<LANES>: SupportedLaneCount,
287284
Simd<$unsigned, LANES>:
288285
WideningMultiply<Output = (Simd<$unsigned, LANES>, Simd<$unsigned, LANES>)>,
289286
StandardUniform: Distribution<Simd<$unsigned, LANES>>,
@@ -294,7 +291,6 @@ macro_rules! uniform_simd_int_impl {
294291
#[cfg(feature = "simd_support")]
295292
impl<const LANES: usize> UniformSampler for UniformInt<Simd<$ty, LANES>>
296293
where
297-
LaneCount<LANES>: SupportedLaneCount,
298294
Simd<$unsigned, LANES>:
299295
WideningMultiply<Output = (Simd<$unsigned, LANES>, Simd<$unsigned, LANES>)>,
300296
StandardUniform: Distribution<Simd<$unsigned, LANES>>,

src/distr/utils.rs

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
//! Math helper functions
1010
1111
#[cfg(feature = "simd_support")]
12-
use core::simd::prelude::*;
12+
use core::simd::SimdElement;
1313
#[cfg(feature = "simd_support")]
14-
use core::simd::{LaneCount, SimdElement, SupportedLaneCount};
14+
use core::simd::prelude::*;
1515

1616
pub(crate) trait WideningMultiply<RHS = Self> {
1717
type Output;
@@ -337,10 +337,7 @@ scalar_float_impl!(f64, u64);
337337
#[cfg(feature = "simd_support")]
338338
macro_rules! simd_impl {
339339
($fty:ident, $uty:ident) => {
340-
impl<const LANES: usize> FloatSIMDUtils for Simd<$fty, LANES>
341-
where
342-
LaneCount<LANES>: SupportedLaneCount,
343-
{
340+
impl<const LANES: usize> FloatSIMDUtils for Simd<$fty, LANES> {
344341
type Mask = Mask<<$fty as SimdElement>::Mask, LANES>;
345342
type UInt = Simd<$uty, LANES>;
346343

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

379376
#[inline]
@@ -383,10 +380,7 @@ macro_rules! simd_impl {
383380
}
384381

385382
#[cfg(test)]
386-
impl<const LANES: usize> FloatSIMDScalarUtils for Simd<$fty, LANES>
387-
where
388-
LaneCount<LANES>: SupportedLaneCount,
389-
{
383+
impl<const LANES: usize> FloatSIMDScalarUtils for Simd<$fty, LANES> {
390384
type Scalar = $fty;
391385

392386
#[inline]

0 commit comments

Comments
 (0)