about summary refs log tree commit diff
diff options
context:
space:
mode:
authorCaleb Zulawski <caleb.zulawski@gmail.com>2021-04-11 11:42:29 -0400
committerJubilee Young <workingjubilee@gmail.com>2021-04-25 16:42:49 -0700
commit1f4e902ee70e178f1009e4242b2dac083bb942d4 (patch)
tree4ad3492d7f1c98d88853cf4342cb57482b57347b
parent24ebae870e11ed60a83ca0acccc202387f95f25f (diff)
downloadrust-1f4e902ee70e178f1009e4242b2dac083bb942d4.tar.gz
rust-1f4e902ee70e178f1009e4242b2dac083bb942d4.zip
Fix saturating math docs
-rw-r--r--crates/core_simd/src/math.rs22
1 files changed, 11 insertions, 11 deletions
diff --git a/crates/core_simd/src/math.rs b/crates/core_simd/src/math.rs
index 23ff83f11a1..e987ec4e9c9 100644
--- a/crates/core_simd/src/math.rs
+++ b/crates/core_simd/src/math.rs
@@ -1,5 +1,5 @@
 macro_rules! impl_uint_arith {
-    ($(($name:ident, $n:ty)),+) => {
+    ($(($name:ident, $n:ident)),+) => {
         $( impl<const LANES: usize> $name<LANES> where Self: crate::LanesAtMost32 {
 
             /// Lanewise saturating add.
@@ -41,7 +41,7 @@ macro_rules! impl_uint_arith {
 }
 
 macro_rules! impl_int_arith {
-    ($(($name:ident, $n:ty)),+) => {
+    ($(($name:ident, $n:ident)),+) => {
         $( impl<const LANES: usize> $name<LANES> where Self: crate::LanesAtMost32 {
 
             /// Lanewise saturating add.
@@ -83,13 +83,12 @@ macro_rules! impl_int_arith {
             /// As abs(), except the MIN value becomes MAX instead of itself.
             ///
             /// # Examples
+            /// ```
             /// # use core_simd::*;
             #[doc = concat!("# use core::", stringify!($n), "::{MIN, MAX};")]
-            #[doc = concat!("let x = ", stringify!($name), "::splat([MIN, -2, 0, 3]);")]
-            /// let unsat = x.abs();
-            /// let sat = x.saturating_abs();
-            #[doc = concat!("assert_eq!(unsat, ", stringify!($name), "::from_array([MIN, 2, 0, 3]);")]
-            #[doc = concat!("assert_eq!(sat, ", stringify!($name), "::from_array([MAX, 2, 0, 3]));")]
+            #[doc = concat!("let x = ", stringify!($name), "::from_array([MIN, -2, 0, 3]);")]
+            /// let abs = x.saturating_abs();
+            #[doc = concat!("assert_eq!(abs, ", stringify!($name), "::from_array([MAX, 2, 0, 3]));")]
             /// ```
             #[inline]
             pub fn saturating_abs(self) -> Self {
@@ -103,12 +102,13 @@ macro_rules! impl_int_arith {
             /// As neg(), except the MIN value becomes MAX instead of itself.
             ///
             /// # Examples
+            /// ```
             /// # use core_simd::*;
             #[doc = concat!("# use core::", stringify!($n), "::{MIN, MAX};")]
-            #[doc = concat!("let x = ", stringify!($name), "::splat([MIN, -2, 3, MAX]);")]
+            #[doc = concat!("let x = ", stringify!($name), "::from_array([MIN, -2, 3, MAX]);")]
             /// let unsat = -x;
             /// let sat = x.saturating_neg();
-            #[doc = concat!("assert_eq!(unsat, ", stringify!($name), "::from_array([MIN, 2, -3, MIN + 1]);")]
+            #[doc = concat!("assert_eq!(unsat, ", stringify!($name), "::from_array([MIN, 2, -3, MIN + 1]));")]
             #[doc = concat!("assert_eq!(sat, ", stringify!($name), "::from_array([MAX, 2, -3, MIN + 1]));")]
             /// ```
             #[inline]
@@ -121,5 +121,5 @@ macro_rules! impl_int_arith {
 
 use crate::vector::*;
 
-impl_uint_arith! { (SimdU8, u8), (SimdU16, u16), (SimdU32, u32), (SimdU64, u64), (SimdUsize, usize) }
-impl_int_arith! { (SimdI8, i8), (SimdI16, i16), (SimdI32, i32), (SimdI64, i64), (SimdIsize, isize) }
+impl_uint_arith! { (SimdU8, u8), (SimdU16, u16), (SimdU32, u32), (SimdU64, u64), (SimdU128, u128), (SimdUsize, usize) }
+impl_int_arith! { (SimdI8, i8), (SimdI16, i16), (SimdI32, i32), (SimdI64, i64), (SimdI128, i128), (SimdIsize, isize) }