about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-04-29 15:45:42 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-04-29 15:45:42 -0700
commit783b4bbf69024fabc2f44c7fc158f82ccf71c4b0 (patch)
treea4137cda1ed751b1ce1127a2988d3b4383bf2682 /src/libcore
parent8daf961a630178cb96d4136b897e3aef66ea854f (diff)
parent83814325b45f9f53480f633d7d36ed005f9fa823 (diff)
downloadrust-783b4bbf69024fabc2f44c7fc158f82ccf71c4b0.tar.gz
rust-783b4bbf69024fabc2f44c7fc158f82ccf71c4b0.zip
rollup merge of #24886: GBGamer/master
These are useful when you want to catch the signals, like when you're making a kernel, or if you just don't want the overhead. (I don't know if there are any of the second kind of people, I don't think it's a good idea, but hey, choice is good).
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/intrinsics.rs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libcore/intrinsics.rs b/src/libcore/intrinsics.rs
index 13b847f6532..ac43055a7c4 100644
--- a/src/libcore/intrinsics.rs
+++ b/src/libcore/intrinsics.rs
@@ -582,3 +582,20 @@ extern "rust-intrinsic" {
     /// cast to a `u64`; if `T` has no discriminant, returns 0.
     pub fn discriminant_value<T>(v: &T) -> u64;
 }
+
+#[cfg(not(stage0))]
+extern "rust-intrinsic" {
+    /// Performs an unchecked signed division, which results in undefined behavior,
+    /// in cases where y == 0, or x == int::MIN and y == -1
+    pub fn unchecked_sdiv<T>(x: T, y: T) -> T;
+    /// Performs an unchecked unsigned division, which results in undefined behavior,
+    /// in cases where y == 0
+    pub fn unchecked_udiv<T>(x: T, y: T) -> T;
+
+    /// Returns the remainder of an unchecked signed division, which results in
+    /// undefined behavior, in cases where y == 0, or x == int::MIN and y == -1
+    pub fn unchecked_urem<T>(x: T, y: T) -> T;
+    /// Returns the remainder of an unchecked signed division, which results in
+    /// undefined behavior, in cases where y == 0
+    pub fn unchecked_srem<T>(x: T, y: T) -> T;
+}