overflowing_sub in sub
This commit is contained in:
parent
7525ff23cf
commit
864e754074
@ -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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user