mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-05 11:33:04 +00:00
Implement Neg only for signed Saturating types
This commit is contained in:
parent
7861121ae4
commit
f136eea97c
@ -384,17 +384,6 @@ macro_rules! saturating_impl {
|
|||||||
}
|
}
|
||||||
forward_ref_op_assign! { impl BitAndAssign, bitand_assign for Saturating<$t>, Saturating<$t> }
|
forward_ref_op_assign! { impl BitAndAssign, bitand_assign for Saturating<$t>, Saturating<$t> }
|
||||||
|
|
||||||
#[unstable(feature = "saturating_int_impl", issue = "87920")]
|
|
||||||
impl Neg for Saturating<$t> {
|
|
||||||
type Output = Self;
|
|
||||||
#[inline]
|
|
||||||
fn neg(self) -> Self {
|
|
||||||
Saturating(0) - self
|
|
||||||
}
|
|
||||||
}
|
|
||||||
forward_ref_unop! { impl Neg, neg for Saturating<$t>,
|
|
||||||
#[unstable(feature = "saturating_int_impl", issue = "87920")] }
|
|
||||||
|
|
||||||
)*)
|
)*)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -864,6 +853,17 @@ macro_rules! saturating_int_impl_signed {
|
|||||||
self.0.is_negative()
|
self.0.is_negative()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[unstable(feature = "saturating_int_impl", issue = "87920")]
|
||||||
|
impl Neg for Saturating<$t> {
|
||||||
|
type Output = Self;
|
||||||
|
#[inline]
|
||||||
|
fn neg(self) -> Self {
|
||||||
|
Saturating(self.0.saturating_neg())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
forward_ref_unop! { impl Neg, neg for Saturating<$t>,
|
||||||
|
#[unstable(feature = "saturating_int_impl", issue = "87920")] }
|
||||||
)*)
|
)*)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user