Skip to content

Commit

Permalink
Auto merge of #40256 - nagisa:compiler-builtin-no-panic-beta, r=alexc…
Browse files Browse the repository at this point in the history
…richton

Beta backport of #40254
  • Loading branch information
bors committed Mar 8, 2017
2 parents ecbf0b5 + e8d90fb commit 92e7b9b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/libcompiler_builtins/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -468,14 +468,15 @@ pub mod reimpls {
}

trait AbsExt: Sized {
fn uabs(self) -> u128_ {
self.iabs() as u128_
}
fn uabs(self) -> u128_;
fn iabs(self) -> i128_;
}

#[cfg(stage0)]
impl AbsExt for i128_ {
fn uabs(self) -> u128_ {
self.iabs() as u128_
}
fn iabs(self) -> i128_ {
let s = self >> 63;
((self ^ s).wrapping_sub(s))
Expand All @@ -484,6 +485,9 @@ pub mod reimpls {

#[cfg(not(stage0))]
impl AbsExt for i128_ {
fn uabs(self) -> u128_ {
self.iabs() as u128_
}
fn iabs(self) -> i128_ {
let s = self >> 127;
((self ^ s).wrapping_sub(s))
Expand Down

0 comments on commit 92e7b9b

Please sign in to comment.