overflowing_sub in sub

This commit is contained in:
Nikolay Volf 2016-02-25 18:02:08 +03:00
parent 7525ff23cf
commit 864e754074

View File

@ -765,9 +765,9 @@ macro_rules! construct_uint {
#[inline]
fn sub(self, other: $name) -> $name {
panic_on_overflow!(self < other);
let res = overflowing!((!other).overflowing_add(From::from(1u64)));
overflowing!(self.overflowing_add(res))
let (result, overflow) = self.overflowing_sub(other);
panic_on_overflow!(overflow);
result
}
}