Skip to content

Commit

Permalink
Implement negation for wrapping numerals.
Browse files Browse the repository at this point in the history
Fixes #33037
  • Loading branch information
notriddle committed Apr 20, 2016
1 parent ed7c567 commit 8a8c432
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 8a8c432

Please sign in to comment.