Skip to content
This repository was archived by the owner on May 28, 2025. It is now read-only.

Commit b962b61

Browse files
committed
Change lane to element in documentation
1 parent f510c6b commit b962b61

File tree

13 files changed

+163
-163
lines changed

13 files changed

+163
-163
lines changed

crates/core_simd/examples/matrix_inversion.rs

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -179,58 +179,58 @@ pub fn simd_inv4x4(m: Matrix4x4) -> Option<Matrix4x4> {
179179
let row2 = simd_swizzle!(tmp, row3, SHUFFLE02);
180180
let row3 = simd_swizzle!(row3, tmp, SHUFFLE13);
181181

182-
let tmp = (row2 * row3).reverse().rotate_lanes_right::<2>();
182+
let tmp = (row2 * row3).reverse().rotate_elements_right::<2>();
183183
let minor0 = row1 * tmp;
184184
let minor1 = row0 * tmp;
185-
let tmp = tmp.rotate_lanes_right::<2>();
185+
let tmp = tmp.rotate_elements_right::<2>();
186186
let minor0 = (row1 * tmp) - minor0;
187187
let minor1 = (row0 * tmp) - minor1;
188-
let minor1 = minor1.rotate_lanes_right::<2>();
188+
let minor1 = minor1.rotate_elements_right::<2>();
189189

190-
let tmp = (row1 * row2).reverse().rotate_lanes_right::<2>();
190+
let tmp = (row1 * row2).reverse().rotate_elements_right::<2>();
191191
let minor0 = (row3 * tmp) + minor0;
192192
let minor3 = row0 * tmp;
193-
let tmp = tmp.rotate_lanes_right::<2>();
193+
let tmp = tmp.rotate_elements_right::<2>();
194194

195195
let minor0 = minor0 - row3 * tmp;
196196
let minor3 = row0 * tmp - minor3;
197-
let minor3 = minor3.rotate_lanes_right::<2>();
197+
let minor3 = minor3.rotate_elements_right::<2>();
198198

199-
let tmp = (row3 * row1.rotate_lanes_right::<2>())
199+
let tmp = (row3 * row1.rotate_elements_right::<2>())
200200
.reverse()
201-
.rotate_lanes_right::<2>();
202-
let row2 = row2.rotate_lanes_right::<2>();
201+
.rotate_elements_right::<2>();
202+
let row2 = row2.rotate_elements_right::<2>();
203203
let minor0 = row2 * tmp + minor0;
204204
let minor2 = row0 * tmp;
205-
let tmp = tmp.rotate_lanes_right::<2>();
205+
let tmp = tmp.rotate_elements_right::<2>();
206206
let minor0 = minor0 - row2 * tmp;
207207
let minor2 = row0 * tmp - minor2;
208-
let minor2 = minor2.rotate_lanes_right::<2>();
208+
let minor2 = minor2.rotate_elements_right::<2>();
209209

210-
let tmp = (row0 * row1).reverse().rotate_lanes_right::<2>();
210+
let tmp = (row0 * row1).reverse().rotate_elements_right::<2>();
211211
let minor2 = minor2 + row3 * tmp;
212212
let minor3 = row2 * tmp - minor3;
213-
let tmp = tmp.rotate_lanes_right::<2>();
213+
let tmp = tmp.rotate_elements_right::<2>();
214214
let minor2 = row3 * tmp - minor2;
215215
let minor3 = minor3 - row2 * tmp;
216216

217-
let tmp = (row0 * row3).reverse().rotate_lanes_right::<2>();
217+
let tmp = (row0 * row3).reverse().rotate_elements_right::<2>();
218218
let minor1 = minor1 - row2 * tmp;
219219
let minor2 = row1 * tmp + minor2;
220-
let tmp = tmp.rotate_lanes_right::<2>();
220+
let tmp = tmp.rotate_elements_right::<2>();
221221
let minor1 = row2 * tmp + minor1;
222222
let minor2 = minor2 - row1 * tmp;
223223

224-
let tmp = (row0 * row2).reverse().rotate_lanes_right::<2>();
224+
let tmp = (row0 * row2).reverse().rotate_elements_right::<2>();
225225
let minor1 = row3 * tmp + minor1;
226226
let minor3 = minor3 - row1 * tmp;
227-
let tmp = tmp.rotate_lanes_right::<2>();
227+
let tmp = tmp.rotate_elements_right::<2>();
228228
let minor1 = minor1 - row3 * tmp;
229229
let minor3 = row1 * tmp + minor3;
230230

231231
let det = row0 * minor0;
232-
let det = det.rotate_lanes_right::<2>() + det;
233-
let det = det.reverse().rotate_lanes_right::<2>() + det;
232+
let det = det.rotate_elements_right::<2>() + det;
233+
let det = det.reverse().rotate_elements_right::<2>() + det;
234234

235235
if det.reduce_sum() == 0. {
236236
return None;

crates/core_simd/src/masks.rs

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! Types and traits associated with masking lanes of vectors.
1+
//! Types and traits associated with masking elements of vectors.
22
//! Types representing
33
#![allow(non_camel_case_types)]
44

@@ -82,7 +82,7 @@ impl_element! { isize }
8282

8383
/// A SIMD vector mask for `LANES` elements of width specified by `Element`.
8484
///
85-
/// Masks represent boolean inclusion/exclusion on a per-lane basis.
85+
/// Masks represent boolean inclusion/exclusion on a per-element basis.
8686
///
8787
/// The layout of this type is unspecified, and may change between platforms
8888
/// and/or Rust versions, and code should not assume that it is equivalent to
@@ -116,7 +116,7 @@ where
116116
T: MaskElement,
117117
LaneCount<LANES>: SupportedLaneCount,
118118
{
119-
/// Construct a mask by setting all lanes to the given value.
119+
/// Construct a mask by setting all elements to the given value.
120120
#[inline]
121121
pub fn splat(value: bool) -> Self {
122122
Self(mask_impl::Mask::splat(value))
@@ -163,7 +163,7 @@ where
163163
/// represents `true`.
164164
///
165165
/// # Safety
166-
/// All lanes must be either 0 or -1.
166+
/// All elements must be either 0 or -1.
167167
#[inline]
168168
#[must_use = "method returns a new mask and does not mutate the original value"]
169169
pub unsafe fn from_int_unchecked(value: Simd<T, LANES>) -> Self {
@@ -175,7 +175,7 @@ where
175175
/// represents `true`.
176176
///
177177
/// # Panics
178-
/// Panics if any lane is not 0 or -1.
178+
/// Panics if any element is not 0 or -1.
179179
#[inline]
180180
#[must_use = "method returns a new mask and does not mutate the original value"]
181181
#[track_caller]
@@ -193,71 +193,71 @@ where
193193
self.0.to_int()
194194
}
195195

196-
/// Converts the mask to a mask of any other lane size.
196+
/// Converts the mask to a mask of any other element size.
197197
#[inline]
198198
#[must_use = "method returns a new mask and does not mutate the original value"]
199199
pub fn cast<U: MaskElement>(self) -> Mask<U, LANES> {
200200
Mask(self.0.convert())
201201
}
202202

203-
/// Tests the value of the specified lane.
203+
/// Tests the value of the specified element.
204204
///
205205
/// # Safety
206-
/// `lane` must be less than `LANES`.
206+
/// `element` must be less than `self.len()`.
207207
#[inline]
208208
#[must_use = "method returns a new bool and does not mutate the original value"]
209-
pub unsafe fn test_unchecked(&self, lane: usize) -> bool {
209+
pub unsafe fn test_unchecked(&self, index: usize) -> bool {
210210
// Safety: the caller must confirm this invariant
211-
unsafe { self.0.test_unchecked(lane) }
211+
unsafe { self.0.test_unchecked(index) }
212212
}
213213

214-
/// Tests the value of the specified lane.
214+
/// Tests the value of the specified element.
215215
///
216216
/// # Panics
217-
/// Panics if `lane` is greater than or equal to the number of lanes in the vector.
217+
/// Panics if `index` is greater than or equal to the number of elements in the vector.
218218
#[inline]
219219
#[must_use = "method returns a new bool and does not mutate the original value"]
220220
#[track_caller]
221-
pub fn test(&self, lane: usize) -> bool {
222-
assert!(lane < LANES, "lane index out of range");
223-
// Safety: the lane index has been checked
224-
unsafe { self.test_unchecked(lane) }
221+
pub fn test(&self, index: usize) -> bool {
222+
assert!(index < LANES, "element index out of range");
223+
// Safety: the element index has been checked
224+
unsafe { self.test_unchecked(index) }
225225
}
226226

227-
/// Sets the value of the specified lane.
227+
/// Sets the value of the specified element.
228228
///
229229
/// # Safety
230-
/// `lane` must be less than `LANES`.
230+
/// `index` must be less than `self.len()`.
231231
#[inline]
232-
pub unsafe fn set_unchecked(&mut self, lane: usize, value: bool) {
232+
pub unsafe fn set_unchecked(&mut self, index: usize, value: bool) {
233233
// Safety: the caller must confirm this invariant
234234
unsafe {
235-
self.0.set_unchecked(lane, value);
235+
self.0.set_unchecked(index, value);
236236
}
237237
}
238238

239-
/// Sets the value of the specified lane.
239+
/// Sets the value of the specified element.
240240
///
241241
/// # Panics
242-
/// Panics if `lane` is greater than or equal to the number of lanes in the vector.
242+
/// Panics if `index` is greater than or equal to the number of elements in the vector.
243243
#[inline]
244244
#[track_caller]
245-
pub fn set(&mut self, lane: usize, value: bool) {
246-
assert!(lane < LANES, "lane index out of range");
247-
// Safety: the lane index has been checked
245+
pub fn set(&mut self, index: usize, value: bool) {
246+
assert!(index < LANES, "element index out of range");
247+
// Safety: the element index has been checked
248248
unsafe {
249-
self.set_unchecked(lane, value);
249+
self.set_unchecked(index, value);
250250
}
251251
}
252252

253-
/// Returns true if any lane is set, or false otherwise.
253+
/// Returns true if any element is set, or false otherwise.
254254
#[inline]
255255
#[must_use = "method returns a new bool and does not mutate the original value"]
256256
pub fn any(self) -> bool {
257257
self.0.any()
258258
}
259259

260-
/// Returns true if all lanes are set, or false otherwise.
260+
/// Returns true if all elements are set, or false otherwise.
261261
#[inline]
262262
#[must_use = "method returns a new bool and does not mutate the original value"]
263263
pub fn all(self) -> bool {
@@ -294,7 +294,7 @@ where
294294
LaneCount<LANES>: SupportedLaneCount,
295295
{
296296
#[inline]
297-
#[must_use = "method returns a defaulted mask with all lanes set to false (0)"]
297+
#[must_use = "method returns a defaulted mask with all elements set to false (0)"]
298298
fn default() -> Self {
299299
Self::splat(false)
300300
}
@@ -332,7 +332,7 @@ where
332332
#[inline]
333333
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
334334
f.debug_list()
335-
.entries((0..LANES).map(|lane| self.test(lane)))
335+
.entries((0..LANES).map(|i| self.test(i)))
336336
.finish()
337337
}
338338
}

crates/core_simd/src/masks/to_bitmask.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ where
1616

1717
/// Converts masks to and from integer bitmasks.
1818
///
19-
/// Each bit of the bitmask corresponds to a mask lane, starting with the LSB.
19+
/// Each bit of the bitmask corresponds to a mask element, starting with the LSB.
2020
pub trait ToBitMask: Sealed {
2121
/// The integer bitmask type.
2222
type BitMask;
@@ -30,7 +30,7 @@ pub trait ToBitMask: Sealed {
3030

3131
/// Converts masks to and from byte array bitmasks.
3232
///
33-
/// Each bit of the bitmask corresponds to a mask lane, starting with the LSB of the first byte.
33+
/// Each bit of the bitmask corresponds to a mask element, starting with the LSB of the first byte.
3434
pub trait ToBitMaskArray: Sealed {
3535
/// The bitmask array.
3636
type BitMaskArray: Copy

crates/core_simd/src/select.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ where
66
T: MaskElement,
77
LaneCount<LANES>: SupportedLaneCount,
88
{
9-
/// Choose lanes from two vectors.
9+
/// Choose elements from two vectors.
1010
///
11-
/// For each lane in the mask, choose the corresponding lane from `true_values` if
12-
/// that lane mask is true, and `false_values` if that lane mask is false.
11+
/// For each element in the mask, choose the corresponding element from `true_values` if
12+
/// that element mask is true, and `false_values` if that element mask is false.
1313
///
1414
/// # Examples
1515
/// ```
@@ -36,10 +36,10 @@ where
3636
unsafe { intrinsics::simd_select(self.to_int(), true_values, false_values) }
3737
}
3838

39-
/// Choose lanes from two masks.
39+
/// Choose elements from two masks.
4040
///
41-
/// For each lane in the mask, choose the corresponding lane from `true_values` if
42-
/// that lane mask is true, and `false_values` if that lane mask is false.
41+
/// For each element in the mask, choose the corresponding element from `true_values` if
42+
/// that element mask is true, and `false_values` if that element mask is false.
4343
///
4444
/// # Examples
4545
/// ```

crates/core_simd/src/simd/cmp/eq.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@ pub trait SimdPartialEq {
99
/// The mask type returned by each comparison.
1010
type Mask;
1111

12-
/// Test if each lane is equal to the corresponding lane in `other`.
12+
/// Test if each element is equal to the corresponding element in `other`.
1313
#[must_use = "method returns a new mask and does not mutate the original value"]
1414
fn simd_eq(self, other: Self) -> Self::Mask;
1515

16-
/// Test if each lane is equal to the corresponding lane in `other`.
16+
/// Test if each element is equal to the corresponding element in `other`.
1717
#[must_use = "method returns a new mask and does not mutate the original value"]
1818
fn simd_ne(self, other: Self) -> Self::Mask;
1919
}

crates/core_simd/src/simd/cmp/ord.rs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,41 @@ use crate::simd::{
77

88
/// Parallel `PartialOrd`.
99
pub trait SimdPartialOrd: SimdPartialEq {
10-
/// Test if each lane is less than the corresponding lane in `other`.
10+
/// Test if each element is less than the corresponding element in `other`.
1111
#[must_use = "method returns a new mask and does not mutate the original value"]
1212
fn simd_lt(self, other: Self) -> Self::Mask;
1313

14-
/// Test if each lane is less than or equal to the corresponding lane in `other`.
14+
/// Test if each element is less than or equal to the corresponding element in `other`.
1515
#[must_use = "method returns a new mask and does not mutate the original value"]
1616
fn simd_le(self, other: Self) -> Self::Mask;
1717

18-
/// Test if each lane is greater than the corresponding lane in `other`.
18+
/// Test if each element is greater than the corresponding element in `other`.
1919
#[must_use = "method returns a new mask and does not mutate the original value"]
2020
fn simd_gt(self, other: Self) -> Self::Mask;
2121

22-
/// Test if each lane is greater than or equal to the corresponding lane in `other`.
22+
/// Test if each element is greater than or equal to the corresponding element in `other`.
2323
#[must_use = "method returns a new mask and does not mutate the original value"]
2424
fn simd_ge(self, other: Self) -> Self::Mask;
2525
}
2626

2727
/// Parallel `Ord`.
2828
pub trait SimdOrd: SimdPartialOrd {
29-
/// Returns the lane-wise maximum with `other`.
29+
/// Returns the element-wise maximum with `other`.
3030
#[must_use = "method returns a new vector and does not mutate the original value"]
3131
fn simd_max(self, other: Self) -> Self;
3232

33-
/// Returns the lane-wise minimum with `other`.
33+
/// Returns the element-wise minimum with `other`.
3434
#[must_use = "method returns a new vector and does not mutate the original value"]
3535
fn simd_min(self, other: Self) -> Self;
3636

37-
/// Restrict each lane to a certain interval.
37+
/// Restrict each element to a certain interval.
3838
///
39-
/// For each lane, returns `max` if `self` is greater than `max`, and `min` if `self` is
39+
/// For each element, returns `max` if `self` is greater than `max`, and `min` if `self` is
4040
/// less than `min`. Otherwise returns `self`.
4141
///
4242
/// # Panics
4343
///
44-
/// Panics if `min > max` on any lane.
44+
/// Panics if `min > max` on any element.
4545
#[must_use = "method returns a new vector and does not mutate the original value"]
4646
fn simd_clamp(self, min: Self, max: Self) -> Self;
4747
}
@@ -101,7 +101,7 @@ macro_rules! impl_integer {
101101
fn simd_clamp(self, min: Self, max: Self) -> Self {
102102
assert!(
103103
min.simd_le(max).all(),
104-
"each lane in `min` must be less than or equal to the corresponding lane in `max`",
104+
"each element in `min` must be less than or equal to the corresponding element in `max`",
105105
);
106106
self.simd_max(min).simd_min(max)
107107
}
@@ -208,7 +208,7 @@ macro_rules! impl_mask {
208208
fn simd_clamp(self, min: Self, max: Self) -> Self {
209209
assert!(
210210
min.simd_le(max).all(),
211-
"each lane in `min` must be less than or equal to the corresponding lane in `max`",
211+
"each element in `min` must be less than or equal to the corresponding element in `max`",
212212
);
213213
self.simd_max(min).simd_min(max)
214214
}
@@ -263,7 +263,7 @@ where
263263
fn simd_clamp(self, min: Self, max: Self) -> Self {
264264
assert!(
265265
min.simd_le(max).all(),
266-
"each lane in `min` must be less than or equal to the corresponding lane in `max`",
266+
"each element in `min` must be less than or equal to the corresponding element in `max`",
267267
);
268268
self.simd_max(min).simd_min(max)
269269
}
@@ -313,7 +313,7 @@ where
313313
fn simd_clamp(self, min: Self, max: Self) -> Self {
314314
assert!(
315315
min.simd_le(max).all(),
316-
"each lane in `min` must be less than or equal to the corresponding lane in `max`",
316+
"each element in `min` must be less than or equal to the corresponding element in `max`",
317317
);
318318
self.simd_max(min).simd_min(max)
319319
}

0 commit comments

Comments
 (0)