I have two i64
s, I know one is greater than the other, and I want to get their difference as a u64
. I've tried (a - b) as u64
, but this panics when a - b
overflows as an i64
. (I don't really care what happens if b
is greater than a
, but a panic would be nice.)
Thank you!
a.wrapping_sub(b) as u64
.
2 Likes