about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorWesley Wiser <wwiser@gmail.com>2016-11-08 20:22:09 -0500
committerWesley Wiser <wwiser@gmail.com>2016-11-08 22:03:27 -0500
commita62a67cc6a8bb3e69b81eebf1265fb1c19103c32 (patch)
treede206c789a09a37b34fd9163639183411b696f14 /src
parenta3f75fb07222c3c6d7efe0c4252f413deb489246 (diff)
downloadrust-a62a67cc6a8bb3e69b81eebf1265fb1c19103c32.tar.gz
rust-a62a67cc6a8bb3e69b81eebf1265fb1c19103c32.zip
Add documentation for some of the add/sub/mul intrinsics
Part of #34338
Diffstat (limited to 'src')
-rw-r--r--src/libcore/intrinsics.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 7f37b744148..3726eee9a93 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -1166,12 +1166,21 @@ extern "rust-intrinsic" {
     pub fn bswap<T>(x: T) -> T;
 
     /// Performs checked integer addition.
+    /// The stabilized versions of this intrinsic are available on the integer
+    /// primitives via the `overflowing_add` method. For example,
+    /// [`std::u32::overflowing_add`](../../std/primitive.u32.html#method.overflowing_add)
     pub fn add_with_overflow<T>(x: T, y: T) -> (T, bool);
 
     /// Performs checked integer subtraction
+    /// The stabilized versions of this intrinsic are available on the integer
+    /// primitives via the `overflowing_sub` method. For example,
+    /// [`std::u32::overflowing_sub`](../../std/primitive.u32.html#method.overflowing_sub)
     pub fn sub_with_overflow<T>(x: T, y: T) -> (T, bool);
 
     /// Performs checked integer multiplication
+    /// The stabilized versions of this intrinsic are available on the integer
+    /// primitives via the `overflowing_mul` method. For example,
+    /// [`std::u32::overflowing_mul`](../../std/primitive.u32.html#method.overflowing_mul)
     pub fn mul_with_overflow<T>(x: T, y: T) -> (T, bool);
 
     /// Performs an unchecked division, resulting in undefined behavior
@@ -1182,10 +1191,19 @@ extern "rust-intrinsic" {
     pub fn unchecked_rem<T>(x: T, y: T) -> T;
 
     /// Returns (a + b) mod 2^N, where N is the width of T in bits.
+    /// The stabilized versions of this intrinsic are available on the integer
+    /// primitives via the `wrapping_add` method. For example,
+    /// [`std::u32::wrapping_add`](../../std/primitive.u32.html#method.wrapping_add)
     pub fn overflowing_add<T>(a: T, b: T) -> T;
     /// Returns (a - b) mod 2^N, where N is the width of T in bits.
+    /// The stabilized versions of this intrinsic are available on the integer
+    /// primitives via the `wrapping_sub` method. For example,
+    /// [`std::u32::wrapping_sub`](../../std/primitive.u32.html#method.wrapping_sub)
     pub fn overflowing_sub<T>(a: T, b: T) -> T;
     /// Returns (a * b) mod 2^N, where N is the width of T in bits.
+    /// The stabilized versions of this intrinsic are available on the integer
+    /// primitives via the `wrapping_mul` method. For example,
+    /// [`std::u32::wrapping_mul`](../../std/primitive.u32.html#method.wrapping_mul)
     pub fn overflowing_mul<T>(a: T, b: T) -> T;
 
     /// Returns the value of the discriminant for the variant in 'v',