@@ -7,19 +7,6 @@ pub struct Fpscr {
7
7
bits : u32 ,
8
8
}
9
9
10
- /// Rounding mode
11
- #[ derive( Clone , Copy , Debug ) ]
12
- pub enum RMode {
13
- /// Round to Nearest (RN) mode. This is the reset value.
14
- Nearest ,
15
- /// Round towards Plus Infinity (RP) mode.
16
- PlusInfinity ,
17
- /// Round towards Minus Infinity (RM) mode.
18
- MinusInfinity ,
19
- /// Round towards Zero (RZ) mode.
20
- Zero ,
21
- }
22
-
23
10
impl Fpscr {
24
11
/// Creates a `Fspcr` value from raw bits.
25
12
#[ inline]
@@ -251,6 +238,45 @@ impl Fpscr {
251
238
}
252
239
}
253
240
241
+ /// Rounding mode
242
+ #[ derive( Clone , Copy , Debug , Eq , PartialEq ) ]
243
+ pub enum RMode {
244
+ /// Round to Nearest (RN) mode. This is the reset value.
245
+ Nearest ,
246
+ /// Round towards Plus Infinity (RP) mode.
247
+ PlusInfinity ,
248
+ /// Round towards Minus Infinity (RM) mode.
249
+ MinusInfinity ,
250
+ /// Round towards Zero (RZ) mode.
251
+ Zero ,
252
+ }
253
+
254
+ impl RMode {
255
+ /// Is Nearest the current rounding mode?
256
+ #[ inline]
257
+ fn is_nearest ( self ) -> bool {
258
+ self == RMode :: Nearest
259
+ }
260
+
261
+ /// Is Plus Infinity the current rounding mode?
262
+ #[ inline]
263
+ fn is_plus_infinity ( self ) -> bool {
264
+ self == RMode :: PlusInfinity
265
+ }
266
+
267
+ /// Is Minus Infinity the current rounding mode?
268
+ #[ inline]
269
+ fn is_minus_infinity ( self ) -> bool {
270
+ self == RMode :: MinusInfinity
271
+ }
272
+
273
+ /// Is Zero the current rounding mode?
274
+ #[ inline]
275
+ fn is_zero ( self ) -> bool {
276
+ self == RMode :: Zero
277
+ }
278
+ }
279
+
254
280
/// Read the FPSCR register
255
281
#[ inline]
256
282
pub fn read ( ) -> Fpscr {
0 commit comments