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] #[inline]
fn sub(self, other: $name) -> $name { fn sub(self, other: $name) -> $name {
panic_on_overflow!(self < other); let (result, overflow) = self.overflowing_sub(other);
let res = overflowing!((!other).overflowing_add(From::from(1u64))); panic_on_overflow!(overflow);
overflowing!(self.overflowing_add(res)) result
} }
} }