Skip to content

Commit 912efc0

Browse files
committed
---
yaml --- r: 60813 b: refs/heads/auto c: 35655a0 h: refs/heads/master i: 60811: 72888f5 v: v3
1 parent 6031465 commit 912efc0

File tree

3 files changed

+20
-5
lines changed

3 files changed

+20
-5
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,6 @@ refs/heads/try3: 9387340aab40a73e8424c48fd42f0c521a4875c0
1414
refs/tags/release-0.3.1: 495bae036dfe5ec6ceafd3312b4dca48741e845b
1515
refs/tags/release-0.4: e828ea2080499553b97dfe33b3f4d472b4562ad7
1616
refs/tags/release-0.5: 7e3bcfbf21278251ee936ad53e92e9b719702d73
17-
refs/heads/auto: d2957091c496be86fe4b648a0ccae08753122661
17+
refs/heads/auto: 35655a0fb3bde60985d5f92437a729c37bb8755a
1818
refs/heads/servo: af82457af293e2a842ba6b7759b70288da276167
1919
refs/tags/release-0.6: b4ebcfa1812664df5e142f0134a5faea3918544c

branches/auto/src/libstd/num/f32.rs

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ delegate!(
8686
fn erfc(n: c_float) -> c_float = c_float_utils::erfc,
8787
fn exp_m1(n: c_float) -> c_float = c_float_utils::exp_m1,
8888
fn abs_sub(a: c_float, b: c_float) -> c_float = c_float_utils::abs_sub,
89-
fn fmax(a: c_float, b: c_float) -> c_float = c_float_utils::fmax,
90-
fn fmin(a: c_float, b: c_float) -> c_float = c_float_utils::fmin,
9189
fn next_after(x: c_float, y: c_float) -> c_float = c_float_utils::next_after,
9290
fn frexp(n: c_float, value: &mut c_int) -> c_float = c_float_utils::frexp,
9391
fn hypot(x: c_float, y: c_float) -> c_float = c_float_utils::hypot,
@@ -147,6 +145,16 @@ pub fn ge(x: f32, y: f32) -> bool { return x >= y; }
147145
#[inline(always)]
148146
pub fn gt(x: f32, y: f32) -> bool { return x > y; }
149147

148+
#[inline(always)]
149+
pub fn fmax(x: f32, y: f32) -> f32 {
150+
if x >= y || y.is_NaN() { x } else { y }
151+
}
152+
153+
#[inline(always)]
154+
pub fn fmin(x: f32, y: f32) -> f32 {
155+
if x <= y || y.is_NaN() { x } else { y }
156+
}
157+
150158

151159
// FIXME (#1999): replace the predicates below with llvm intrinsics or
152160
// calls to the libmath macros in the rust runtime for performance.

branches/auto/src/libstd/num/f64.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ delegate!(
8787
fn erfc(n: c_double) -> c_double = c_double_utils::erfc,
8888
fn exp_m1(n: c_double) -> c_double = c_double_utils::exp_m1,
8989
fn abs_sub(a: c_double, b: c_double) -> c_double = c_double_utils::abs_sub,
90-
fn fmax(a: c_double, b: c_double) -> c_double = c_double_utils::fmax,
91-
fn fmin(a: c_double, b: c_double) -> c_double = c_double_utils::fmin,
9290
fn next_after(x: c_double, y: c_double) -> c_double = c_double_utils::next_after,
9391
fn frexp(n: c_double, value: &mut c_int) -> c_double = c_double_utils::frexp,
9492
fn hypot(x: c_double, y: c_double) -> c_double = c_double_utils::hypot,
@@ -172,6 +170,15 @@ pub fn ge(x: f64, y: f64) -> bool { return x >= y; }
172170
#[inline(always)]
173171
pub fn gt(x: f64, y: f64) -> bool { return x > y; }
174172

173+
#[inline(always)]
174+
pub fn fmax(x: f64, y: f64) -> f64 {
175+
if x >= y || y.is_NaN() { x } else { y }
176+
}
177+
178+
#[inline(always)]
179+
pub fn fmin(x: f64, y: f64) -> f64 {
180+
if x <= y || y.is_NaN() { x } else { y }
181+
}
175182

176183
// FIXME (#1999): add is_normal, is_subnormal, and fpclassify
177184

0 commit comments

Comments
 (0)