File tree Expand file tree Collapse file tree 1 file changed +7
-18
lines changed Expand file tree Collapse file tree 1 file changed +7
-18
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ pub trait Zero: Add<Self, Self> {
7575 fn zero ( ) -> Self ;
7676
7777 /// Returns `true` if `self` is equal to the additive identity.
78+ #[ inline]
7879 fn is_zero ( & self ) -> bool ;
7980}
8081
@@ -89,32 +90,20 @@ macro_rules! zero_impl(
8990 }
9091)
9192
92- macro_rules! zero_float_impl(
93- ( $t: ty, $v: expr) => {
94- impl Zero for $t {
95- #[ inline]
96- fn zero( ) -> $t { $v }
97-
98- #[ inline]
99- fn is_zero( & self ) -> bool { * self == $v || * self == -$v }
100- }
101- }
102- )
103-
10493zero_impl ! ( uint, 0 u)
105- zero_impl ! ( u8 , 0u8 )
106- zero_impl ! ( u16 , 0u16 )
107- zero_impl ! ( u32 , 0u32 )
108- zero_impl ! ( u64 , 0u64 )
94+ zero_impl ! ( u8 , 0u8 )
95+ zero_impl ! ( u16 , 0u16 )
96+ zero_impl ! ( u32 , 0u32 )
97+ zero_impl ! ( u64 , 0u64 )
10998
11099zero_impl ! ( int, 0 i)
111100zero_impl ! ( i8 , 0i8 )
112101zero_impl ! ( i16 , 0i16 )
113102zero_impl ! ( i32 , 0i32 )
114103zero_impl ! ( i64 , 0i64 )
115104
116- zero_float_impl ! ( f32 , 0.0f32 )
117- zero_float_impl ! ( f64 , 0.0f64 )
105+ zero_impl ! ( f32 , 0.0f32 )
106+ zero_impl ! ( f64 , 0.0f64 )
118107
119108/// Returns the additive identity, `0`.
120109#[ inline( always) ] pub fn zero < T : Zero > ( ) -> T { Zero :: zero ( ) }
You can’t perform that action at this time.
0 commit comments