Skip to content

Commit

Permalink
Auto merge of rust-lang#33067 - notriddle:wrapping_neg, r=alexcrichton
Browse files Browse the repository at this point in the history
Implement negation for wrapping numerals.

Fixes rust-lang#33037
  • Loading branch information
bors committed May 5, 2016
2 parents 8655587 + 8a8c432 commit 3f65afa
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/libcore/num/wrapping.rs
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,15 @@ macro_rules! wrapping_impl {
*self = *self & other;
}
}

#[stable(feature = "wrapping_neg", since = "1.10.0")]
impl Neg for Wrapping<$t> {
type Output = Self;
#[inline(always)]
fn neg(self) -> Self {
Wrapping(0) - self
}
}
)*)
}

Expand Down

0 comments on commit 3f65afa

Please sign in to comment.