Skip to content

Commit 436ca7f

Browse files
Add lanes() and associated LANES const
2 parents b506e3e + ec05dfb commit 436ca7f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

crates/core_simd/src/vector.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,14 @@ where
2424
LaneCount<LANES>: SupportedLaneCount,
2525
T: SimdElement,
2626
{
27+
/// Number of lanes in this vector.
28+
pub const LANES: usize = LANES;
29+
30+
/// Get the number of lanes in this vector.
31+
pub const fn lanes(&self) -> usize {
32+
LANES
33+
}
34+
2735
/// Construct a SIMD vector by setting all lanes to the given value.
2836
pub const fn splat(value: T) -> Self {
2937
Self([value; LANES])

0 commit comments

Comments
 (0)