Skip to content

Commit 61006a0

Browse files
committed
Update intrinsics wrapping documentation
* update intrinsics wrapping documentation * fix variable names
1 parent 3daae5e commit 61006a0

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • library/core/src/intrinsics

library/core/src/intrinsics/mod.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2054,7 +2054,8 @@ pub const fn rotate_right<T: [const] fallback::FunnelShift>(x: T, shift: u32) ->
20542054
unsafe { unchecked_funnel_shr(x, x, shift % (mem::size_of::<T>() as u32 * 8)) }
20552055
}
20562056

2057-
/// Returns (a + b) mod 2<sup>N</sup>, where N is the width of T in bits.
2057+
/// Wrapping (modular) addition. Computes `a + b`,
2058+
/// wrapping around at the boundary of the type.
20582059
///
20592060
/// Note that, unlike most intrinsics, this is safe to call;
20602061
/// it does not require an `unsafe` block.
@@ -2068,7 +2069,8 @@ pub const fn rotate_right<T: [const] fallback::FunnelShift>(x: T, shift: u32) ->
20682069
#[rustc_nounwind]
20692070
#[rustc_intrinsic]
20702071
pub const fn wrapping_add<T: Copy>(a: T, b: T) -> T;
2071-
/// Returns (a - b) mod 2<sup>N</sup>, where N is the width of T in bits.
2072+
/// Wrapping (modular) subtraction. Computes `a - b`,
2073+
/// wrapping around at the boundary of the type.
20722074
///
20732075
/// Note that, unlike most intrinsics, this is safe to call;
20742076
/// it does not require an `unsafe` block.
@@ -2082,7 +2084,8 @@ pub const fn wrapping_add<T: Copy>(a: T, b: T) -> T;
20822084
#[rustc_nounwind]
20832085
#[rustc_intrinsic]
20842086
pub const fn wrapping_sub<T: Copy>(a: T, b: T) -> T;
2085-
/// Returns (a * b) mod 2<sup>N</sup>, where N is the width of T in bits.
2087+
/// Wrapping (modular) multiplication. Computes `a *
2088+
/// b`, wrapping around at the boundary of the type.
20862089
///
20872090
/// Note that, unlike most intrinsics, this is safe to call;
20882091
/// it does not require an `unsafe` block.

0 commit comments

Comments
 (0)