Skip to content

Commit 70cdf22

Browse files
committed
---
yaml --- r: 232749 b: refs/heads/try c: 4653a8b h: refs/heads/master i: 232747: a55fcea v: v3
1 parent 21cdce7 commit 70cdf22

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
refs/heads/master: edeb4f1c86cbf6af8ef9874d4b3af50f721ea1b8
33
refs/heads/snap-stage3: 1af31d4974e33027a68126fa5a5a3c2c6491824f
4-
refs/heads/try: 152c76ef0d62b2529b50356773ac6907a6db0f6e
4+
refs/heads/try: 4653a8b3fd69dbab366a8ec67ae9cf68dc128c43
55
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
66
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
77
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try/src/libcore/ops.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,7 @@ macro_rules! rem_impl_integer {
441441

442442
rem_impl_integer! { usize u8 u16 u32 u64 isize i8 i16 i32 i64 }
443443

444+
#[cfg(not(stage0))]
444445
macro_rules! rem_impl_float {
445446
($($t:ty)*) => ($(
446447
#[stable(feature = "rust1", since = "1.0.0")]
@@ -455,8 +456,48 @@ macro_rules! rem_impl_float {
455456
)*)
456457
}
457458

459+
#[cfg(not(stage0))]
458460
rem_impl_float! { f32 f64 }
459461

462+
#[stable(feature = "rust1", since = "1.0.0")]
463+
#[cfg(stage0)]
464+
impl Rem for f32 {
465+
type Output = f32;
466+
467+
// The builtin f32 rem operator is broken when targeting
468+
// MSVC; see comment in std::f32::floor.
469+
// FIXME: See also #27859.
470+
#[inline]
471+
#[cfg(target_env = "msvc")]
472+
fn rem(self, other: f32) -> f32 {
473+
(self as f64).rem(other as f64) as f32
474+
}
475+
476+
#[inline]
477+
#[cfg(not(target_env = "msvc"))]
478+
fn rem(self, other: f32) -> f32 {
479+
extern { fn fmodf(a: f32, b: f32) -> f32; }
480+
unsafe { fmodf(self, other) }
481+
}
482+
}
483+
484+
#[stable(feature = "rust1", since = "1.0.0")]
485+
#[cfg(stage0)]
486+
impl Rem for f64 {
487+
type Output = f64;
488+
489+
#[inline]
490+
fn rem(self, other: f64) -> f64 {
491+
extern { fn fmod(a: f64, b: f64) -> f64; }
492+
unsafe { fmod(self, other) }
493+
}
494+
}
495+
496+
#[cfg(stage0)]
497+
forward_ref_binop! { impl Rem, rem for f64, f64 }
498+
#[cfg(stage0)]
499+
forward_ref_binop! { impl Rem, rem for f32, f32 }
500+
460501
/// The `Neg` trait is used to specify the functionality of unary `-`.
461502
///
462503
/// # Examples

0 commit comments

Comments
 (0)