about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee <46493976+workingjubilee@users.noreply.github.com>2021-09-29 14:19:45 -0700
committerGitHub <noreply@github.com>2021-09-29 14:19:45 -0700
commit436ca7f7aa60f0ffe2591a1e5658e85f9e0af22f (patch)
treea3ae77842980f6a49de5b07e01a5547af086fc1c
parentb506e3e28e7a476119cead381e54094d6fe0257e (diff)
parentec05dfbbf9f77f706feb4858aa6b38e4d84bf12f (diff)
downloadrust-436ca7f7aa60f0ffe2591a1e5658e85f9e0af22f.tar.gz
rust-436ca7f7aa60f0ffe2591a1e5658e85f9e0af22f.zip
Add lanes() and associated LANES const
-rw-r--r--crates/core_simd/src/vector.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/core_simd/src/vector.rs b/crates/core_simd/src/vector.rs
index eee53385c15..9cefe384264 100644
--- a/crates/core_simd/src/vector.rs
+++ b/crates/core_simd/src/vector.rs
@@ -24,6 +24,14 @@ where
     LaneCount<LANES>: 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
+    }
+
     /// Construct a SIMD vector by setting all lanes to the given value.
     pub const fn splat(value: T) -> Self {
         Self([value; LANES])