aboutsummaryrefslogtreecommitdiff
path: root/libcore/fmt
diff options
context:
space:
mode:
authorpravic <[email protected]>2016-04-29 21:25:33 +0300
committerpravic <[email protected]>2016-04-29 21:25:33 +0300
commit8c8ef9d5b88377f345220e577ca78e1713b87539 (patch)
tree9bf7ae22e9e635b67734aeb14226d4ed9e0b58c0 /libcore/fmt
parentadd libcore from 2016-04-11 nightly (diff)
downloadkmd-env-rs-8c8ef9d5b88377f345220e577ca78e1713b87539.tar.xz
kmd-env-rs-8c8ef9d5b88377f345220e577ca78e1713b87539.zip
apply libcore_nofp patch
Diffstat (limited to 'libcore/fmt')
-rw-r--r--libcore/fmt/mod.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/libcore/fmt/mod.rs b/libcore/fmt/mod.rs
index 2f02f5c..3637238 100644
--- a/libcore/fmt/mod.rs
+++ b/libcore/fmt/mod.rs
@@ -17,6 +17,7 @@ use prelude::v1::*;
use cell::{UnsafeCell, Cell, RefCell, Ref, RefMut, BorrowState};
use marker::PhantomData;
use mem;
+#[cfg(not(disable_float))]
use num::flt2dec;
use ops::Deref;
use result;
@@ -1023,6 +1024,7 @@ impl<'a> Formatter<'a> {
/// Takes the formatted parts and applies the padding.
/// Assumes that the caller already has rendered the parts with required precision,
/// so that `self.precision` can be ignored.
+ #[cfg(not(disable_float))]
fn pad_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
if let Some(mut width) = self.width {
// for the sign-aware zero padding, we render the sign first and
@@ -1059,6 +1061,7 @@ impl<'a> Formatter<'a> {
}
}
+ #[cfg(not(disable_float))]
fn write_formatted_parts(&mut self, formatted: &flt2dec::Formatted) -> Result {
fn write_bytes(buf: &mut Write, s: &[u8]) -> Result {
buf.write_str(unsafe { str::from_utf8_unchecked(s) })
@@ -1447,6 +1450,7 @@ impl<'a, T: ?Sized> Pointer for &'a mut T {
}
}
+#[cfg(not(disable_float))]
// Common code of floating point Debug and Display.
fn float_to_decimal_common<T>(fmt: &mut Formatter, num: &T, negative_zero: bool) -> Result
where T: flt2dec::DecodableFloat
@@ -1471,6 +1475,7 @@ fn float_to_decimal_common<T>(fmt: &mut Formatter, num: &T, negative_zero: bool)
fmt.pad_formatted_parts(&formatted)
}
+#[cfg(not(disable_float))]
// Common code of floating point LowerExp and UpperExp.
fn float_to_exponential_common<T>(fmt: &mut Formatter, num: &T, upper: bool) -> Result
where T: flt2dec::DecodableFloat
@@ -1524,7 +1529,9 @@ macro_rules! floating { ($ty:ident) => {
}
}
} }
+#[cfg(not(disable_float))]
floating! { f32 }
+#[cfg(not(disable_float))]
floating! { f64 }
// Implementation of Display/Debug for various core types