diff options
| author | Brian Anderson <banderson@mozilla.com> | 2013-05-19 19:46:54 -0700 |
|---|---|---|
| committer | Brian Anderson <banderson@mozilla.com> | 2013-05-19 23:34:32 -0700 |
| commit | 66319b027888ceddf024a5919e007caceaf369f3 (patch) | |
| tree | d210e635c950974972a086f7caa4268be6f33c93 /src/libcore/num | |
| parent | 3a481c0f88025318eba7c48907a5c1d966e01d27 (diff) | |
| download | rust-66319b027888ceddf024a5919e007caceaf369f3.tar.gz rust-66319b027888ceddf024a5919e007caceaf369f3.zip | |
Register snapshots
Diffstat (limited to 'src/libcore/num')
| -rw-r--r-- | src/libcore/num/f32.rs | 10 | ||||
| -rw-r--r-- | src/libcore/num/f64.rs | 10 | ||||
| -rw-r--r-- | src/libcore/num/int-template.rs | 28 | ||||
| -rw-r--r-- | src/libcore/num/uint-template.rs | 29 | ||||
| -rw-r--r-- | src/libcore/num/uint-template/uint.rs | 23 |
5 files changed, 0 insertions, 100 deletions
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs index d580f7aa26c..d5dc0dd4730 100644 --- a/src/libcore/num/f32.rs +++ b/src/libcore/num/f32.rs @@ -248,18 +248,8 @@ impl Orderable for f32 { if self.is_NaN() || other.is_NaN() { Float::NaN() } else { fmax(*self, *other) } } - #[cfg(stage0)] - #[inline(always)] - fn clamp(&self, mn: &f32, mx: &f32) -> f32 { - if self.is_NaN() { *self } - else if !(*self <= *mx) { *mx } - else if !(*self >= *mn) { *mn } - else { *self } - } - /// Returns the number constrained within the range `mn <= self <= mx`. /// If any of the numbers are `NaN` then `NaN` is returned. - #[cfg(not(stage0))] #[inline(always)] fn clamp(&self, mn: &f32, mx: &f32) -> f32 { cond!( diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs index d140df30c42..6e2496e2e45 100644 --- a/src/libcore/num/f64.rs +++ b/src/libcore/num/f64.rs @@ -270,18 +270,8 @@ impl Orderable for f64 { if self.is_NaN() || other.is_NaN() { Float::NaN() } else { fmax(*self, *other) } } - #[cfg(stage0)] - #[inline(always)] - fn clamp(&self, mn: &f64, mx: &f64) -> f64 { - if self.is_NaN() { *self } - else if !(*self <= *mx) { *mx } - else if !(*self >= *mn) { *mn } - else { *self } - } - /// Returns the number constrained within the range `mn <= self <= mx`. /// If any of the numbers are `NaN` then `NaN` is returned. - #[cfg(not(stage0))] #[inline(always)] fn clamp(&self, mn: &f64, mx: &f64) -> f64 { cond!( diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs index d0e6174ec63..3c31a7d5745 100644 --- a/src/libcore/num/int-template.rs +++ b/src/libcore/num/int-template.rs @@ -108,37 +108,17 @@ pub fn _range_step(start: T, stop: T, step: T, it: &fn(T) -> bool) -> bool { return true; } -#[cfg(stage0)] -pub fn range_step(start: T, stop: T, step: T, it: &fn(T) -> bool) { - _range_step(start, stop, step, it); -} -#[cfg(not(stage0))] pub fn range_step(start: T, stop: T, step: T, it: &fn(T) -> bool) -> bool { _range_step(start, stop, step, it) } #[inline(always)] -#[cfg(stage0)] -/// Iterate over the range [`lo`..`hi`) -pub fn range(lo: T, hi: T, it: &fn(T) -> bool) { - range_step(lo, hi, 1 as T, it); -} - -#[inline(always)] -#[cfg(not(stage0))] /// Iterate over the range [`lo`..`hi`) pub fn range(lo: T, hi: T, it: &fn(T) -> bool) -> bool { range_step(lo, hi, 1 as T, it) } #[inline(always)] -#[cfg(stage0)] -/// Iterate over the range [`hi`..`lo`) -pub fn range_rev(hi: T, lo: T, it: &fn(T) -> bool) { - range_step(hi, lo, -1 as T, it); -} -#[inline(always)] -#[cfg(not(stage0))] /// Iterate over the range [`hi`..`lo`) pub fn range_rev(hi: T, lo: T, it: &fn(T) -> bool) -> bool { range_step(hi, lo, -1 as T, it) @@ -187,15 +167,7 @@ impl Orderable for T { if *self > *other { *self } else { *other } } - #[cfg(stage0)] - #[inline(always)] - fn clamp(&self, mn: &T, mx: &T) -> T { - if *self > *mx { *mx } else - if *self < *mn { *mn } else { *self } - } - /// Returns the number constrained within the range `mn <= self <= mx`. - #[cfg(not(stage0))] #[inline(always)] fn clamp(&self, mn: &T, mx: &T) -> T { cond!( diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs index f3e14094505..66ff16cbeb1 100644 --- a/src/libcore/num/uint-template.rs +++ b/src/libcore/num/uint-template.rs @@ -77,38 +77,17 @@ pub fn _range_step(start: T, return true; } -#[cfg(stage0)] -pub fn range_step(start: T, stop: T, step: T_SIGNED, it: &fn(T) -> bool) { - _range_step(start, stop, step, it); -} -#[cfg(not(stage0))] pub fn range_step(start: T, stop: T, step: T_SIGNED, it: &fn(T) -> bool) -> bool { _range_step(start, stop, step, it) } #[inline(always)] -#[cfg(stage0)] -/// Iterate over the range [`lo`..`hi`) -pub fn range(lo: T, hi: T, it: &fn(T) -> bool) { - range_step(lo, hi, 1 as T_SIGNED, it); -} - -#[inline(always)] -#[cfg(not(stage0))] /// Iterate over the range [`lo`..`hi`) pub fn range(lo: T, hi: T, it: &fn(T) -> bool) -> bool { range_step(lo, hi, 1 as T_SIGNED, it) } #[inline(always)] -#[cfg(stage0)] -/// Iterate over the range [`hi`..`lo`) -pub fn range_rev(hi: T, lo: T, it: &fn(T) -> bool) { - range_step(hi, lo, -1 as T_SIGNED, it); -} - -#[inline(always)] -#[cfg(not(stage0))] /// Iterate over the range [`hi`..`lo`) pub fn range_rev(hi: T, lo: T, it: &fn(T) -> bool) -> bool { range_step(hi, lo, -1 as T_SIGNED, it) @@ -153,15 +132,7 @@ impl Orderable for T { if *self > *other { *self } else { *other } } - #[cfg(stage0)] - #[inline(always)] - fn clamp(&self, mn: &T, mx: &T) -> T { - if *self > *mx { *mx } else - if *self < *mn { *mn } else { *self } - } - /// Returns the number constrained within the range `mn <= self <= mx`. - #[cfg(not(stage0))] #[inline(always)] fn clamp(&self, mn: &T, mx: &T) -> T { cond!( diff --git a/src/libcore/num/uint-template/uint.rs b/src/libcore/num/uint-template/uint.rs index b4c9bb65371..763c305f221 100644 --- a/src/libcore/num/uint-template/uint.rs +++ b/src/libcore/num/uint-template/uint.rs @@ -154,29 +154,6 @@ pub mod inst { return true; } - #[cfg(stage0)] - impl iter::Times for uint { - #[inline(always)] - /// - /// A convenience form for basic iteration. Given a uint `x`, - /// `for x.times { ... }` executes the given block x times. - /// - /// Equivalent to `for uint::range(0, x) |_| { ... }`. - /// - /// Not defined on all integer types to permit unambiguous - /// use with integer literals of inferred integer-type as - /// the self-value (eg. `for 100.times { ... }`). - /// - fn times(&self, it: &fn() -> bool) { - let mut i = *self; - while i > 0 { - if !it() { break } - i -= 1; - } - } - } - - #[cfg(not(stage0))] impl iter::Times for uint { #[inline(always)] /// |
