about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2013-08-08 14:32:02 -0700
committerbors <bors@rust-lang.org>2013-08-08 14:32:02 -0700
commit8f65dbfcfa11aa521aa59881f6ab064bbd07184e (patch)
tree8d482dd18bcf6651529fa26941b7a1598cd3dfc2 /src/libstd/num
parenta0080f4e07891c89aa1f9851f8b0a3c754734fe8 (diff)
parent878e74e1cedd80a909e06073f8fb677d6ffd895f (diff)
downloadrust-8f65dbfcfa11aa521aa59881f6ab064bbd07184e.tar.gz
rust-8f65dbfcfa11aa521aa59881f6ab064bbd07184e.zip
auto merge of #8385 : cmr/rust/big-rollup, r=alexcrichton
This is a fairly large rollup, but I've tested everything locally, and none of
it should be platform-specific.

r=alexcrichton (bdfdbdd)
r=brson (d803c18)
r=alexcrichton (a5041d0)
r=bstrie (317412a)
r=alexcrichton (135c85e)
r=thestinger (8805baa)
r=pcwalton (0661178)
r=cmr (9397fe0)
r=cmr (caa4135)
r=cmr (6a21d93)
r=cmr (4dc3379)
r=cmr (0aa5154)
r=cmr (18be261)
r=thestinger (f10be03)

Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/f64.rs4
-rw-r--r--src/libstd/num/int_macros.rs18
-rw-r--r--src/libstd/num/strconv.rs6
-rw-r--r--src/libstd/num/uint_macros.rs17
4 files changed, 9 insertions, 36 deletions
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index c7db60e6fd2..60527905779 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -278,18 +278,22 @@ impl One for f64 {
 
 #[cfg(not(test))]
 impl Add<f64,f64> for f64 {
+    #[inline]
     fn add(&self, other: &f64) -> f64 { *self + *other }
 }
 #[cfg(not(test))]
 impl Sub<f64,f64> for f64 {
+    #[inline]
     fn sub(&self, other: &f64) -> f64 { *self - *other }
 }
 #[cfg(not(test))]
 impl Mul<f64,f64> for f64 {
+    #[inline]
     fn mul(&self, other: &f64) -> f64 { *self * *other }
 }
 #[cfg(not(test))]
 impl Div<f64,f64> for f64 {
+    #[inline]
     fn div(&self, other: &f64) -> f64 { *self / *other }
 }
 #[cfg(not(test))]
diff --git a/src/libstd/num/int_macros.rs b/src/libstd/num/int_macros.rs
index 9842a570d7e..b692bedebfd 100644
--- a/src/libstd/num/int_macros.rs
+++ b/src/libstd/num/int_macros.rs
@@ -124,14 +124,6 @@ pub fn range_step_inclusive(start: $T, last: $T, step: $T, it: &fn($T) -> bool)
     range_step_core(start, last, step, Closed, it)
 }
 
-
-#[inline]
-/// Iterate over the range (`hi`..`lo`]
-pub fn range_rev(hi: $T, lo: $T, it: &fn($T) -> bool) -> bool {
-    if hi == min_value { return true; }
-    range_step_inclusive(hi-1, lo, -1 as $T, it)
-}
-
 impl Num for $T {}
 
 #[cfg(not(test))]
@@ -889,10 +881,6 @@ mod tests {
     fn test_ranges() {
         let mut l = ~[];
 
-        do range_rev(14,11) |i| {
-            l.push(i);
-            true
-        };
         do range_step(20,26,2) |i| {
             l.push(i);
             true
@@ -917,8 +905,7 @@ mod tests {
             l.push(i);
             true
         };
-        assert_eq!(l, ~[13,12,11,
-                        20,22,24,
+        assert_eq!(l, ~[20,22,24,
                         36,34,32,
                         max_value-2,
                         max_value-3,max_value-1,
@@ -926,9 +913,6 @@ mod tests {
                         min_value+3,min_value+1]);
 
         // None of the `fail`s should execute.
-        do range_rev(0,10) |_i| {
-            fail!(~"unreachable");
-        };
         do range_step(10,0,1) |_i| {
             fail!(~"unreachable");
         };
diff --git a/src/libstd/num/strconv.rs b/src/libstd/num/strconv.rs
index 7ab3c81b61f..1f22343ad9c 100644
--- a/src/libstd/num/strconv.rs
+++ b/src/libstd/num/strconv.rs
@@ -422,9 +422,9 @@ pub fn float_to_str_common<T:NumCast+Zero+One+Eq+Ord+NumStrConv+Float+Round+
 
 // Some constants for from_str_bytes_common's input validation,
 // they define minimum radix values for which the character is a valid digit.
-priv static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u;
-priv static DIGIT_I_RADIX: uint = ('i' as uint) - ('a' as uint) + 11u;
-priv static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
+static DIGIT_P_RADIX: uint = ('p' as uint) - ('a' as uint) + 11u;
+static DIGIT_I_RADIX: uint = ('i' as uint) - ('a' as uint) + 11u;
+static DIGIT_E_RADIX: uint = ('e' as uint) - ('a' as uint) + 11u;
 
 /**
  * Parses a byte slice as a number. This is meant to
diff --git a/src/libstd/num/uint_macros.rs b/src/libstd/num/uint_macros.rs
index a2874c96703..29b8f29d87d 100644
--- a/src/libstd/num/uint_macros.rs
+++ b/src/libstd/num/uint_macros.rs
@@ -125,13 +125,6 @@ pub fn range_step_inclusive(start: $T, last: $T, step: $T_SIGNED, it: &fn($T) ->
     range_step_core(start, last, step, Closed, it)
 }
 
-#[inline]
-/// Iterate over the range (`hi`..`lo`]
-pub fn range_rev(hi: $T, lo: $T, it: &fn($T) -> bool) -> bool {
-    if hi == min_value { return true; }
-    range_step_inclusive(hi-1, lo, -1 as $T_SIGNED, it)
-}
-
 impl Num for $T {}
 
 #[cfg(not(test))]
@@ -654,10 +647,6 @@ mod tests {
     pub fn test_ranges() {
         let mut l = ~[];
 
-        do range_rev(14,11) |i| {
-            l.push(i);
-            true
-        };
         do range_step(20,26,2) |i| {
             l.push(i);
             true
@@ -683,8 +672,7 @@ mod tests {
             true
         };
 
-        assert_eq!(l, ~[13,12,11,
-                        20,22,24,
+        assert_eq!(l, ~[20,22,24,
                         36,34,32,
                         max_value-2,
                         max_value-3,max_value-1,
@@ -692,9 +680,6 @@ mod tests {
                         min_value+3,min_value+1]);
 
         // None of the `fail`s should execute.
-        do range_rev(0,0) |_i| {
-            fail!("unreachable");
-        };
         do range_step(10,0,1) |_i| {
             fail!("unreachable");
         };