]> git.lizzy.rs Git - rust.git/commitdiff
rollup merge of #24886: GBGamer/master
authorAlex Crichton <alex@alexcrichton.com>
Wed, 29 Apr 2015 22:45:42 +0000 (15:45 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Wed, 29 Apr 2015 22:45:42 +0000 (15:45 -0700)
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).

1  2 
src/libcore/intrinsics.rs
src/librustc_trans/trans/intrinsic.rs
src/librustc_typeck/check/mod.rs

index 13b847f65329192de9cd4a70fb5ad68ab07ab511,c6bb1fb1cb164c545cd7896bdb27781119661c53..ac43055a7c4a5ff65e3110ad4b5765fb19a0756c
@@@ -580,5 -572,24 +580,22 @@@ extern "rust-intrinsic" 
  
      /// Returns the value of the discriminant for the variant in 'v',
      /// cast to a `u64`; if `T` has no discriminant, returns 0.
 -    // SNAP 5520801
 -    #[cfg(not(stage0))]
      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;
+ }
Simple merge
Simple merge