From 1fd7de062e77cb0464eeb0ad0b07c555151d73d3 Mon Sep 17 00:00:00 2001 From: Caleb Zulawski Date: Sun, 17 Dec 2023 12:48:17 -0500 Subject: Clarify UB and improve grammar Co-authored-by: Ralf Jung --- library/core/src/intrinsics/simd.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/core/src/intrinsics/simd.rs b/library/core/src/intrinsics/simd.rs index e375e5ba42f..b5edd80df70 100644 --- a/library/core/src/intrinsics/simd.rs +++ b/library/core/src/intrinsics/simd.rs @@ -36,7 +36,7 @@ extern "platform-intrinsic" { /// Additionally for signed integers, `::MIN / -1` is undefined behavior. pub fn simd_rem(lhs: T, rhs: T) -> T; - /// Elementwise vector left shift. + /// Elementwise vector left shift, with UB on overflow. /// /// Shift `lhs` left by `rhs`, shifting in sign bits for signed types. /// @@ -47,7 +47,7 @@ extern "platform-intrinsic" { /// Each element of `rhs` must be less than `::BITS`. pub fn simd_shl(lhs: T, rhs: T) -> T; - /// Elementwise vector right shift. + /// Elementwise vector right shift, with UB on overflow. /// /// Shift `lhs` right by `rhs`, shifting in sign bits for signed types. /// @@ -75,11 +75,11 @@ extern "platform-intrinsic" { /// Numerically cast a vector, elementwise. /// - /// When casting floats to integers, the result is truncated. + /// When casting floats to integers, the result is truncated. Out-of-bounds result lead to UB. /// When casting integers to floats, the result is rounded. /// Otherwise, truncates or extends the value, maintaining the sign for signed integers. /// - /// `T` and `U` be a vectors of integer or floating point primitive types, and must have the + /// `T` and `U` must be vectors of integer or floating point primitive types, and must have the /// same length. /// /// # Safety -- cgit 1.4.1-3-g733a5