Merge pull request #188 from gavofyork/wrapping_ops

removed overflowing_shr
This commit is contained in:
Arkadiy Paronyan 2016-01-19 12:26:12 +01:00
commit 718b3e8664

View File

@ -111,8 +111,6 @@ pub trait Uint: Sized + Default + FromStr + From<u64> + FromJson + fmt::Debug +
fn overflowing_neg(self) -> (Self, bool); fn overflowing_neg(self) -> (Self, bool);
fn overflowing_shl(self, shift: u32) -> (Self, bool); fn overflowing_shl(self, shift: u32) -> (Self, bool);
fn overflowing_shr(self, shift: u32) -> (Self, bool);
} }
macro_rules! construct_uint { macro_rules! construct_uint {
@ -367,12 +365,6 @@ macro_rules! construct_uint {
} }
($name(ret), overflow) ($name(ret), overflow)
} }
fn overflowing_shr(self, _shift32: u32) -> ($name, bool) {
// TODO [todr] not used for now
unimplemented!();
}
} }
impl $name { impl $name {
@ -1311,28 +1303,6 @@ mod tests {
); );
} }
#[ignore]
#[test]
pub fn uint256_shr_overflow() {
assert_eq!(
U256::from_str("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap()
.overflowing_shr(4),
(U256::from_str("0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap(), true)
);
}
#[ignore]
#[test]
pub fn uint256_shr_overflow2() {
assert_eq!(
U256::from_str("fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0").unwrap()
.overflowing_shr(4),
(U256::from_str("0fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff").unwrap(), false)
);
}
#[test] #[test]
pub fn uint256_mul() { pub fn uint256_mul() {
assert_eq!( assert_eq!(