Remove the absv implementation, it isn't needed by Rust
This commit is contained in:
parent
d546f18756
commit
0a0a8f37c9
20
src/lib.rs
20
src/lib.rs
@ -118,23 +118,3 @@ impl IndexMut<RangeFull> for U64 {
|
|||||||
unsafe { &mut *(self as *const _ as *mut u64) }
|
unsafe { &mut *(self as *const _ as *mut u64) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
macro_rules! absv_i2 {
|
|
||||||
($intrinsic:ident : $ty:ty) => {
|
|
||||||
#[no_mangle]
|
|
||||||
pub extern "C" fn $intrinsic(x: $ty) -> $ty {
|
|
||||||
let n = <$ty>::bits();
|
|
||||||
if x == 1 << (n - 1) {
|
|
||||||
panic!();
|
|
||||||
}
|
|
||||||
let y = x >> (n - 1);
|
|
||||||
(x ^ y) - y
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
absv_i2!(__absvsi2: i32);
|
|
||||||
absv_i2!(__absvdi2: i64);
|
|
||||||
// TODO(rust-lang/35118)?
|
|
||||||
// absv_i2!(__absvti2, i128);
|
|
||||||
|
24
src/test.rs
24
src/test.rs
@ -2,30 +2,6 @@ use std::panic;
|
|||||||
|
|
||||||
use quickcheck::TestResult;
|
use quickcheck::TestResult;
|
||||||
|
|
||||||
macro_rules! absv_i2 {
|
|
||||||
($intrinsic:ident: $ty:ident) => {
|
|
||||||
#[test]
|
|
||||||
fn $intrinsic() {
|
|
||||||
assert!(panic::catch_unwind(|| ::$intrinsic(::std::$ty::MIN)).is_err());
|
|
||||||
assert_eq!(::$intrinsic(::std::$ty::MIN + 1), ::std::$ty::MAX);
|
|
||||||
assert_eq!(::$intrinsic(::std::$ty::MIN + 2), ::std::$ty::MAX - 1);
|
|
||||||
assert_eq!(::$intrinsic(-1), 1);
|
|
||||||
assert_eq!(::$intrinsic(-2), 2);
|
|
||||||
assert_eq!(::$intrinsic(0), 0);
|
|
||||||
assert_eq!(::$intrinsic(1), 1);
|
|
||||||
assert_eq!(::$intrinsic(2), 2);
|
|
||||||
assert_eq!(::$intrinsic(2), 2);
|
|
||||||
assert_eq!(::$intrinsic(::std::$ty::MAX - 1), ::std::$ty::MAX - 1);
|
|
||||||
assert_eq!(::$intrinsic(::std::$ty::MAX), ::std::$ty::MAX);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
absv_i2!(__absvsi2: i32);
|
|
||||||
absv_i2!(__absvdi2: i64);
|
|
||||||
// TODO(rust-lang/35118)?
|
|
||||||
// absv_i2!(__absvti2: i128);
|
|
||||||
|
|
||||||
quickcheck! {
|
quickcheck! {
|
||||||
fn udivmoddi4(n: (u32, u32), d: (u32, u32)) -> TestResult {
|
fn udivmoddi4(n: (u32, u32), d: (u32, u32)) -> TestResult {
|
||||||
let n = ::U64 { low: n.0, high: n.1 }[..];
|
let n = ::U64 { low: n.0, high: n.1 }[..];
|
||||||
|
Loading…
Reference in New Issue
Block a user