Skip to content

Commit 32b195a

Browse files
committed
Change generic LANES to N
1 parent 0f59409 commit 32b195a

File tree

20 files changed

+313
-314
lines changed

20 files changed

+313
-314
lines changed

crates/core_simd/src/fmt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
use crate::simd::{LaneCount, Simd, SimdElement, SupportedLaneCount};
22
use core::fmt;
33

4-
impl<T, const LANES: usize> fmt::Debug for Simd<T, LANES>
4+
impl<T, const N: usize> fmt::Debug for Simd<T, N>
55
where
6-
LaneCount<LANES>: SupportedLaneCount,
6+
LaneCount<N>: SupportedLaneCount,
77
T: SimdElement + fmt::Debug,
88
{
99
/// A `Simd<T, N>` has a debug format like the one for `[T]`:

crates/core_simd/src/iter.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,39 +6,39 @@ use core::{
66

77
macro_rules! impl_traits {
88
{ $type:ty } => {
9-
impl<const LANES: usize> Sum<Self> for Simd<$type, LANES>
9+
impl<const N: usize> Sum<Self> for Simd<$type, N>
1010
where
11-
LaneCount<LANES>: SupportedLaneCount,
11+
LaneCount<N>: SupportedLaneCount,
1212
{
1313
#[inline]
1414
fn sum<I: Iterator<Item = Self>>(iter: I) -> Self {
1515
iter.fold(Simd::splat(0 as $type), Add::add)
1616
}
1717
}
1818

19-
impl<const LANES: usize> Product<Self> for Simd<$type, LANES>
19+
impl<const N: usize> Product<Self> for Simd<$type, N>
2020
where
21-
LaneCount<LANES>: SupportedLaneCount,
21+
LaneCount<N>: SupportedLaneCount,
2222
{
2323
#[inline]
2424
fn product<I: Iterator<Item = Self>>(iter: I) -> Self {
2525
iter.fold(Simd::splat(1 as $type), Mul::mul)
2626
}
2727
}
2828

29-
impl<'a, const LANES: usize> Sum<&'a Self> for Simd<$type, LANES>
29+
impl<'a, const N: usize> Sum<&'a Self> for Simd<$type, N>
3030
where
31-
LaneCount<LANES>: SupportedLaneCount,
31+
LaneCount<N>: SupportedLaneCount,
3232
{
3333
#[inline]
3434
fn sum<I: Iterator<Item = &'a Self>>(iter: I) -> Self {
3535
iter.fold(Simd::splat(0 as $type), Add::add)
3636
}
3737
}
3838

39-
impl<'a, const LANES: usize> Product<&'a Self> for Simd<$type, LANES>
39+
impl<'a, const N: usize> Product<&'a Self> for Simd<$type, N>
4040
where
41-
LaneCount<LANES>: SupportedLaneCount,
41+
LaneCount<N>: SupportedLaneCount,
4242
{
4343
#[inline]
4444
fn product<I: Iterator<Item = &'a Self>>(iter: I) -> Self {

crates/core_simd/src/lane_count.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,11 @@ mod sealed {
44
use sealed::Sealed;
55

66
/// Specifies the number of lanes in a SIMD vector as a type.
7-
pub struct LaneCount<const LANES: usize>;
7+
pub struct LaneCount<const N: usize>;
88

9-
impl<const LANES: usize> LaneCount<LANES> {
9+
impl<const N: usize> LaneCount<N> {
1010
/// The number of bytes in a bitmask with this many lanes.
11-
pub const BITMASK_LEN: usize = (LANES + 7) / 8;
11+
pub const BITMASK_LEN: usize = (N + 7) / 8;
1212
}
1313

1414
/// Statically guarantees that a lane count is marked as supported.
@@ -21,7 +21,7 @@ pub trait SupportedLaneCount: Sealed {
2121
type BitMask: Copy + Default + AsRef<[u8]> + AsMut<[u8]>;
2222
}
2323

24-
impl<const LANES: usize> Sealed for LaneCount<LANES> {}
24+
impl<const N: usize> Sealed for LaneCount<N> {}
2525

2626
macro_rules! supported_lane_count {
2727
($($lanes:literal),+) => {

0 commit comments

Comments
 (0)