]> git.lizzy.rs Git - rust.git/commitdiff
Make core::num::dec2flt::strategy::grisu::Fp methods public.
authorRobin Kruppe <robin.kruppe@gmail.com>
Sat, 27 Jun 2015 19:59:31 +0000 (21:59 +0200)
committerRobin Kruppe <robin.kruppe@gmail.com>
Sat, 8 Aug 2015 15:12:29 +0000 (17:12 +0200)
The intent is to allow decimal-to-float parsing to use Fp in its fast path.
That code is added in a later commit.

src/libcore/num/flt2dec/strategy/grisu.rs

index 390920a354cfb6de1e1f8d57e53efc0a8cf2dbad..52eafcec184d242e8c6103d5368186fc5e047f4c 100644 (file)
@@ -34,7 +34,7 @@ pub struct Fp {
 
 impl Fp {
     /// Returns a correctly rounded product of itself and `other`.
-    fn mul(&self, other: &Fp) -> Fp {
+    pub fn mul(&self, other: &Fp) -> Fp {
         const MASK: u64 = 0xffffffff;
         let a = self.f >> 32;
         let b = self.f & MASK;
@@ -51,7 +51,7 @@ fn mul(&self, other: &Fp) -> Fp {
     }
 
     /// Normalizes itself so that the resulting mantissa is at least `2^63`.
-    fn normalize(&self) -> Fp {
+    pub fn normalize(&self) -> Fp {
         let mut f = self.f;
         let mut e = self.e;
         if f >> (64 - 32) == 0 { f <<= 32; e -= 32; }
@@ -66,7 +66,7 @@ fn normalize(&self) -> Fp {
 
     /// Normalizes itself to have the shared exponent.
     /// It can only decrease the exponent (and thus increase the mantissa).
-    fn normalize_to(&self, e: i16) -> Fp {
+    pub fn normalize_to(&self, e: i16) -> Fp {
         let edelta = self.e - e;
         assert!(edelta >= 0);
         let edelta = edelta as usize;