Skip to main content

lightweight_simd/
alias.rs

1// Most or all contents generated by AI (model glm-5.3)
2
3//! Type aliases for common element/lane-count combinations.
4//!
5//! Element aliases are enforced-alignment vector types from [`crate::aligned`]:
6//! the alignment is the vector's byte size rounded up to a power of two, capped
7//! at 64 bytes. Mask aliases are plain [`Simd<bool, N>`] — masks are
8//! register-resident temporaries and carry no enforced alignment.
9
10#[cfg(feature = "half")]
11use crate::Aligned4;
12use crate::{Aligned8, Aligned16, Aligned32, Aligned64, Simd};
13
14#[duplicate::duplicate_item(
15    _name_  _elem_  _n_  _vec_;
16    [f64x2]   [f64]  [2]   [Aligned16];
17    [f64x4]   [f64]  [4]   [Aligned32];
18    [f64x8]   [f64]  [8]   [Aligned64];
19    [f64x16]  [f64]  [16]  [Aligned64];
20    [f32x2]   [f32]  [2]   [Aligned8];
21    [f32x4]   [f32]  [4]   [Aligned16];
22    [f32x8]   [f32]  [8]   [Aligned32];
23    [f32x16]  [f32]  [16]  [Aligned64];
24    [i64x2]   [i64]  [2]   [Aligned16];
25    [i64x4]   [i64]  [4]   [Aligned32];
26    [i64x8]   [i64]  [8]   [Aligned64];
27    [i64x16]  [i64]  [16]  [Aligned64];
28    [i32x4]   [i32]  [4]   [Aligned16];
29    [i32x8]   [i32]  [8]   [Aligned32];
30    [i32x16]  [i32]  [16]  [Aligned64];
31    [i16x4]   [i16]  [4]   [Aligned8];
32    [i16x8]   [i16]  [8]   [Aligned16];
33    [i16x16]  [i16]  [16]  [Aligned32];
34    [i16x32]  [i16]  [32]  [Aligned64];
35    [i8x8]    [i8]   [8]   [Aligned8];
36    [i8x16]   [i8]   [16]  [Aligned16];
37    [i8x32]   [i8]   [32]  [Aligned32];
38    [i8x64]   [i8]   [64]  [Aligned64];
39)]
40#[allow(non_camel_case_types)]
41#[doc = concat!("Alias of [`Simd<", stringify!(_elem_), ", ", stringify!(_n_), ">`](crate::Simd) with enforced alignment (", stringify!(_vec_), ").")]
42pub type _name_ = _vec_<_elem_, _n_>;
43
44#[cfg(feature = "complex")]
45#[duplicate::duplicate_item(
46    _name_  _elem_                    _n_  _vec_;
47    [c64x2]  [num_complex::Complex<f64>]  [2]   [Aligned32];
48    [c64x4]  [num_complex::Complex<f64>]  [4]   [Aligned64];
49    [c64x8]  [num_complex::Complex<f64>]  [8]   [Aligned64];
50    [c32x4]  [num_complex::Complex<f32>]  [4]   [Aligned32];
51    [c32x8]  [num_complex::Complex<f32>]  [8]   [Aligned64];
52    [c32x16] [num_complex::Complex<f32>]  [16]  [Aligned64];
53)]
54#[allow(non_camel_case_types)]
55#[doc = concat!("Alias of [`Simd<", stringify!(_elem_), ", ", stringify!(_n_), ">`](crate::Simd) with enforced alignment (", stringify!(_vec_), ").")]
56pub type _name_ = _vec_<_elem_, _n_>;
57
58#[cfg(feature = "half")]
59#[duplicate::duplicate_item(
60    _name_     _elem_       _n_  _vec_;
61    [f16x2]    [half::f16]  [2]   [Aligned4];
62    [f16x4]    [half::f16]  [4]   [Aligned8];
63    [f16x8]    [half::f16]  [8]   [Aligned16];
64    [f16x16]   [half::f16]  [16]  [Aligned32];
65    [f16x32]   [half::f16]  [32]  [Aligned64];
66    [f16x64]   [half::f16]  [64]  [Aligned64];
67    [bf16x2]   [half::bf16] [2]   [Aligned4];
68    [bf16x4]   [half::bf16] [4]   [Aligned8];
69    [bf16x8]   [half::bf16] [8]   [Aligned16];
70    [bf16x16]  [half::bf16] [16]  [Aligned32];
71    [bf16x32]  [half::bf16] [32]  [Aligned64];
72    [bf16x64]  [half::bf16] [64]  [Aligned64];
73)]
74#[allow(non_camel_case_types)]
75#[doc = concat!("Alias of [`Simd<", stringify!(_elem_), ", ", stringify!(_n_), ">`](crate::Simd) with enforced alignment (", stringify!(_vec_), ").")]
76pub type _name_ = _vec_<_elem_, _n_>;
77
78#[duplicate::duplicate_item(
79    _name_   _n_;
80    [mask4]   [4];
81    [mask8]   [8];
82    [mask16]  [16];
83    [mask32]  [32];
84)]
85#[allow(non_camel_case_types)]
86#[doc = concat!("Plain (unaligned) mask alias of [`Simd<bool, ", stringify!(_n_), ">`](crate::Simd).")]
87pub type _name_ = Simd<bool, _n_>;