@@ -120,41 +120,51 @@ macro_rules! float_impl {
120
120
const IMPLICIT_BIT : Self :: Int = 1 << Self :: SIGNIFICAND_BITS ;
121
121
const EXPONENT_MASK : Self :: Int = !( Self :: SIGN_MASK | Self :: SIGNIFICAND_MASK ) ;
122
122
123
+ #[ inline( always) ]
123
124
fn repr( self ) -> Self :: Int {
124
125
self . to_bits( )
125
126
}
127
+ #[ inline( always) ]
126
128
fn signed_repr( self ) -> Self :: SignedInt {
127
129
self . to_bits( ) as Self :: SignedInt
128
130
}
131
+ #[ inline( always) ]
129
132
fn eq_repr( self , rhs: Self ) -> bool {
130
133
if self . is_nan( ) && rhs. is_nan( ) {
131
134
true
132
135
} else {
133
136
self . repr( ) == rhs. repr( )
134
137
}
135
138
}
139
+ #[ inline( always) ]
136
140
fn sign( self ) -> bool {
137
141
self . signed_repr( ) < Self :: SignedInt :: ZERO
138
142
}
143
+ #[ inline( always) ]
139
144
fn exp( self ) -> Self :: ExpInt {
140
145
( ( self . to_bits( ) & Self :: EXPONENT_MASK ) >> Self :: SIGNIFICAND_BITS ) as Self :: ExpInt
141
146
}
147
+ #[ inline( always) ]
142
148
fn frac( self ) -> Self :: Int {
143
149
self . to_bits( ) & Self :: SIGNIFICAND_MASK
144
150
}
151
+ #[ inline( always) ]
145
152
fn imp_frac( self ) -> Self :: Int {
146
153
self . frac( ) | Self :: IMPLICIT_BIT
147
154
}
155
+ #[ inline( always) ]
148
156
fn from_repr( a: Self :: Int ) -> Self {
149
157
Self :: from_bits( a)
150
158
}
159
+ #[ inline( always) ]
151
160
fn from_parts( sign: bool , exponent: Self :: Int , significand: Self :: Int ) -> Self {
152
161
Self :: from_repr(
153
162
( ( sign as Self :: Int ) << ( Self :: BITS - 1 ) )
154
163
| ( ( exponent << Self :: SIGNIFICAND_BITS ) & Self :: EXPONENT_MASK )
155
164
| ( significand & Self :: SIGNIFICAND_MASK ) ,
156
165
)
157
166
}
167
+ #[ inline( always) ]
158
168
fn normalize( significand: Self :: Int ) -> ( i32 , Self :: Int ) {
159
169
let shift = significand
160
170
. leading_zeros( )
@@ -164,6 +174,7 @@ macro_rules! float_impl {
164
174
significand << shift as Self :: Int ,
165
175
)
166
176
}
177
+ #[ inline( always) ]
167
178
fn is_subnormal( self ) -> bool {
168
179
( self . repr( ) & Self :: EXPONENT_MASK ) == Self :: Int :: ZERO
169
180
}
0 commit comments