]> git.lizzy.rs Git - rust.git/blobdiff - src/libcore/num/f32.rs
Rename and namespace `FPCategory`
[rust.git] / src / libcore / num / f32.rs
index add42a2ddce8441bc83331cd5f15702a033453ef..d8b22a085aa94da348aa26ead942c511cb1d335c 100644 (file)
@@ -18,7 +18,8 @@
 
 use intrinsics;
 use mem;
-use num::{Float, FPNormal, FPCategory, FPZero, FPSubnormal, FPInfinite, FPNaN};
+use num::Float;
+use num::FpCategory as Fp;
 use num::from_str_radix;
 use option::Option;
 
@@ -156,23 +157,23 @@ fn is_finite(self) -> bool {
     /// Returns `true` if the number is neither zero, infinite, subnormal or NaN.
     #[inline]
     fn is_normal(self) -> bool {
-        self.classify() == FPNormal
+        self.classify() == Fp::Normal
     }
 
     /// Returns the floating point category of the number. If only one property
     /// is going to be tested, it is generally faster to use the specific
     /// predicate instead.
-    fn classify(self) -> FPCategory {
+    fn classify(self) -> Fp {
         const EXP_MASK: u32 = 0x7f800000;
         const MAN_MASK: u32 = 0x007fffff;
 
         let bits: u32 = unsafe { mem::transmute(self) };
         match (bits & MAN_MASK, bits & EXP_MASK) {
-            (0, 0)        => FPZero,
-            (_, 0)        => FPSubnormal,
-            (0, EXP_MASK) => FPInfinite,
-            (_, EXP_MASK) => FPNaN,
-            _             => FPNormal,
+            (0, 0)        => Fp::Zero,
+            (_, 0)        => Fp::Subnormal,
+            (0, EXP_MASK) => Fp::Infinite,
+            (_, EXP_MASK) => Fp::Nan,
+            _             => Fp::Normal,
         }
     }