Skip to content

Commit

Permalink
Fix fallout from wrapping_neg revert
Browse files Browse the repository at this point in the history
  • Loading branch information
brson committed Apr 24, 2015
1 parent a21ffcf commit a22ad25
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/libcore/num/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ macro_rules! int_impl {
#[inline]
pub fn abs(self) -> $T {
if self.is_negative() {
self.wrapping_neg()
!self + 1 // wrapping_neg
} else {
self
}
Expand Down
2 changes: 1 addition & 1 deletion src/libserialize/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1538,7 +1538,7 @@ impl<T: Iterator<Item=char>> Parser<T> {
F64Value(res)
} else {
if neg {
let res = (res as i64).wrapping_neg();
let res = !(res as i64) + 1; // wrapping_neg

// Make sure we didn't underflow.
if res > 0 {
Expand Down

0 comments on commit a22ad25

Please sign in to comment.