about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorlcnr/Bastian Kauschke <bastian_kauschke@hotmail.de>2019-06-03 12:59:48 +0200
committerlcnr/Bastian Kauschke <bastian_kauschke@hotmail.de>2019-06-03 12:59:48 +0200
commit4e7319cd3f3b0731416ee14666eb583caac75c97 (patch)
treefca41839aff20311e45c9a9dcdb4e3b6cc8d8305 /src/libcore
parentd6266a7666c22b4a64bbc9252e4ad080f5950d01 (diff)
downloadrust-4e7319cd3f3b0731416ee14666eb583caac75c97.tar.gz
rust-4e7319cd3f3b0731416ee14666eb583caac75c97.zip
add unchecked math intrinsics
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/intrinsics.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 782a7ba4559..31a4e380a3d 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -1240,6 +1240,21 @@ extern "rust-intrinsic" {
     /// y < 0 or y >= N, where N is the width of T in bits.
     pub fn unchecked_shr<T>(x: T, y: T) -> T;
 
+    /// Returns the result of an unchecked addition, resulting in
+    /// undefined behavior when `x + y > T::max_value()` or `x + y < T::min_value()`.
+    #[cfg(not(stage0))]
+    pub fn unchecked_add<T>(x: T, y: T) -> T;
+
+    /// Returns the result of an unchecked substraction, resulting in
+    /// undefined behavior when `x - y > T::max_value()` or `x - y < T::min_value()`.
+    #[cfg(not(stage0))]
+    pub fn unchecked_sub<T>(x: T, y: T) -> T;
+
+    /// Returns the result of an unchecked multiplication, resulting in
+    /// undefined behavior when `x * y > T::max_value()` or `x * y < T::min_value()`.
+    #[cfg(not(stage0))]
+    pub fn unchecked_mul<T>(x: T, y: T) -> T;
+
     /// Performs rotate left.
     /// The stabilized versions of this intrinsic are available on the integer
     /// primitives via the `rotate_left` method. For example,