1
1
macro_rules! impl_uint_arith {
2
- ( $( ( $name: ident, $n: ty ) ) ,+) => {
2
+ ( $( ( $name: ident, $n: ident ) ) ,+) => {
3
3
$( impl <const LANES : usize > $name<LANES > where Self : crate :: LanesAtMost32 {
4
4
5
5
/// Lanewise saturating add.
@@ -41,7 +41,7 @@ macro_rules! impl_uint_arith {
41
41
}
42
42
43
43
macro_rules! impl_int_arith {
44
- ( $( ( $name: ident, $n: ty ) ) ,+) => {
44
+ ( $( ( $name: ident, $n: ident ) ) ,+) => {
45
45
$( impl <const LANES : usize > $name<LANES > where Self : crate :: LanesAtMost32 {
46
46
47
47
/// Lanewise saturating add.
@@ -83,13 +83,12 @@ macro_rules! impl_int_arith {
83
83
/// As abs(), except the MIN value becomes MAX instead of itself.
84
84
///
85
85
/// # Examples
86
+ /// ```
86
87
/// # use core_simd::*;
87
88
#[ doc = concat!( "# use core::" , stringify!( $n) , "::{MIN, MAX};" ) ]
88
- #[ doc = concat!( "let x = " , stringify!( $name) , "::splat([MIN, -2, 0, 3]);" ) ]
89
- /// let unsat = x.abs();
90
- /// let sat = x.saturating_abs();
91
- #[ doc = concat!( "assert_eq!(unsat, " , stringify!( $name) , "::from_array([MIN, 2, 0, 3]);" ) ]
92
- #[ doc = concat!( "assert_eq!(sat, " , stringify!( $name) , "::from_array([MAX, 2, 0, 3]));" ) ]
89
+ #[ doc = concat!( "let x = " , stringify!( $name) , "::from_array([MIN, -2, 0, 3]);" ) ]
90
+ /// let abs = x.saturating_abs();
91
+ #[ doc = concat!( "assert_eq!(abs, " , stringify!( $name) , "::from_array([MAX, 2, 0, 3]));" ) ]
93
92
/// ```
94
93
#[ inline]
95
94
pub fn saturating_abs( self ) -> Self {
@@ -103,12 +102,13 @@ macro_rules! impl_int_arith {
103
102
/// As neg(), except the MIN value becomes MAX instead of itself.
104
103
///
105
104
/// # Examples
105
+ /// ```
106
106
/// # use core_simd::*;
107
107
#[ doc = concat!( "# use core::" , stringify!( $n) , "::{MIN, MAX};" ) ]
108
- #[ doc = concat!( "let x = " , stringify!( $name) , "::splat ([MIN, -2, 3, MAX]);" ) ]
108
+ #[ doc = concat!( "let x = " , stringify!( $name) , "::from_array ([MIN, -2, 3, MAX]);" ) ]
109
109
/// let unsat = -x;
110
110
/// let sat = x.saturating_neg();
111
- #[ doc = concat!( "assert_eq!(unsat, " , stringify!( $name) , "::from_array([MIN, 2, -3, MIN + 1]);" ) ]
111
+ #[ doc = concat!( "assert_eq!(unsat, " , stringify!( $name) , "::from_array([MIN, 2, -3, MIN + 1])) ;" ) ]
112
112
#[ doc = concat!( "assert_eq!(sat, " , stringify!( $name) , "::from_array([MAX, 2, -3, MIN + 1]));" ) ]
113
113
/// ```
114
114
#[ inline]
@@ -121,5 +121,5 @@ macro_rules! impl_int_arith {
121
121
122
122
use crate :: vector:: * ;
123
123
124
- impl_uint_arith ! { ( SimdU8 , u8 ) , ( SimdU16 , u16 ) , ( SimdU32 , u32 ) , ( SimdU64 , u64 ) , ( SimdUsize , usize ) }
125
- impl_int_arith ! { ( SimdI8 , i8 ) , ( SimdI16 , i16 ) , ( SimdI32 , i32 ) , ( SimdI64 , i64 ) , ( SimdIsize , isize ) }
124
+ impl_uint_arith ! { ( SimdU8 , u8 ) , ( SimdU16 , u16 ) , ( SimdU32 , u32 ) , ( SimdU64 , u64 ) , ( SimdU128 , u128 ) , ( SimdUsize , usize ) }
125
+ impl_int_arith ! { ( SimdI8 , i8 ) , ( SimdI16 , i16 ) , ( SimdI32 , i32 ) , ( SimdI64 , i64 ) , ( SimdI128 , i128 ) , ( SimdIsize , isize ) }
0 commit comments