Auto merge of #152 - rust-lang-nursery:gh151, r=alexcrichton
fix debug assertion in modsi3 / moddi3 fixes #151 this fix is very similar to #149 r? @alexcrichton
This commit is contained in:
commit
09145e6bda
|
@ -33,9 +33,10 @@ macro_rules! mod_ {
|
||||||
#[cfg_attr(not(test), no_mangle)]
|
#[cfg_attr(not(test), no_mangle)]
|
||||||
pub extern "C" fn $intrinsic(a: $ty, b: $ty) -> $tyret {
|
pub extern "C" fn $intrinsic(a: $ty, b: $ty) -> $tyret {
|
||||||
let s = b >> (<$ty>::bits() - 1);
|
let s = b >> (<$ty>::bits() - 1);
|
||||||
let b = (b ^ s) - s;
|
// NOTE(wrapping_sub) see comment in the `div` macro
|
||||||
|
let b = (b ^ s).wrapping_sub(s);
|
||||||
let s = a >> (<$ty>::bits() - 1);
|
let s = a >> (<$ty>::bits() - 1);
|
||||||
let a = (a ^ s) - s;
|
let a = (a ^ s).wrapping_sub(s);
|
||||||
|
|
||||||
let r = urem!(a as $uty, b as $uty);
|
let r = urem!(a as $uty, b as $uty);
|
||||||
($conv)((r as $ty ^ s) - s)
|
($conv)((r as $ty ^ s) - s)
|
||||||
|
|
Loading…
Reference in New Issue