From 4fbccafc66fcec3f36d40e4993fc4567c7a89c29 Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Wed, 29 Sep 2021 16:30:42 +0000 Subject: [PATCH 1/2] Add lanes() --- crates/core_simd/src/vector.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index eee53385c15e..4ccdb9c5a5da 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -24,6 +24,11 @@ where LaneCount: SupportedLaneCount, T: SimdElement, { + /// Get the number of lanes in this vector. + pub const fn lanes(&self) -> usize { + LANES + } + /// Construct a SIMD vector by setting all lanes to the given value. pub const fn splat(value: T) -> Self { Self([value; LANES]) From ec05dfbbf9f77f706feb4858aa6b38e4d84bf12f Mon Sep 17 00:00:00 2001 From: Magnus Ulimoen Date: Wed, 29 Sep 2021 17:01:27 +0000 Subject: [PATCH 2/2] Add associated LANES const --- crates/core_simd/src/vector.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs index 4ccdb9c5a5da..9cefe3842641 100644 --- a/crates/core_simd/src/vector.rs +++ b/crates/core_simd/src/vector.rs @@ -24,6 +24,9 @@ where LaneCount: SupportedLaneCount, T: SimdElement, { + /// Number of lanes in this vector. + pub const LANES: usize = LANES; + /// Get the number of lanes in this vector. pub const fn lanes(&self) -> usize { LANES