11macro_rules! impl_uint_arith {
2- ( $( ( $name: ident, $n: ty ) ) ,+) => {
2+ ( $( ( $name: ident, $n: ident ) ) ,+) => {
33 $( impl <const LANES : usize > $name<LANES > where Self : crate :: LanesAtMost32 {
44
55 /// Lanewise saturating add.
@@ -41,7 +41,7 @@ macro_rules! impl_uint_arith {
4141}
4242
4343macro_rules! impl_int_arith {
44- ( $( ( $name: ident, $n: ty ) ) ,+) => {
44+ ( $( ( $name: ident, $n: ident ) ) ,+) => {
4545 $( impl <const LANES : usize > $name<LANES > where Self : crate :: LanesAtMost32 {
4646
4747 /// Lanewise saturating add.
@@ -83,13 +83,12 @@ macro_rules! impl_int_arith {
8383 /// As abs(), except the MIN value becomes MAX instead of itself.
8484 ///
8585 /// # Examples
86+ /// ```
8687 /// # use core_simd::*;
8788 #[ 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]));" ) ]
9392 /// ```
9493 #[ inline]
9594 pub fn saturating_abs( self ) -> Self {
@@ -103,12 +102,13 @@ macro_rules! impl_int_arith {
103102 /// As neg(), except the MIN value becomes MAX instead of itself.
104103 ///
105104 /// # Examples
105+ /// ```
106106 /// # use core_simd::*;
107107 #[ 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]);" ) ]
109109 /// let unsat = -x;
110110 /// 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])) ;" ) ]
112112 #[ doc = concat!( "assert_eq!(sat, " , stringify!( $name) , "::from_array([MAX, 2, -3, MIN + 1]));" ) ]
113113 /// ```
114114 #[ inline]
@@ -121,5 +121,5 @@ macro_rules! impl_int_arith {
121121
122122use crate :: vector:: * ;
123123
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