Skip to content

Commit

Permalink
auto merge of #6034 : thestinger/rust/num, r=catamorphism,pcwalton
Browse files Browse the repository at this point in the history
  • Loading branch information
bors committed Apr 23, 2013
2 parents d9896d5 + a3e33cf commit 0b90493
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/libcore/num/f32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,40 +301,53 @@ impl num::One for f32 {

#[cfg(notest)]
impl Add<f32,f32> for f32 {
#[inline(always)]
fn add(&self, other: &f32) -> f32 { *self + *other }
}

#[cfg(notest)]
impl Sub<f32,f32> for f32 {
#[inline(always)]
fn sub(&self, other: &f32) -> f32 { *self - *other }
}

#[cfg(notest)]
impl Mul<f32,f32> for f32 {
#[inline(always)]
fn mul(&self, other: &f32) -> f32 { *self * *other }
}

#[cfg(stage0,notest)]
impl Div<f32,f32> for f32 {
#[inline(always)]
fn div(&self, other: &f32) -> f32 { *self / *other }
}

#[cfg(stage1,notest)]
#[cfg(stage2,notest)]
#[cfg(stage3,notest)]
impl Quot<f32,f32> for f32 {
#[inline(always)]
fn quot(&self, other: &f32) -> f32 { *self / *other }
}

#[cfg(stage0,notest)]
impl Modulo<f32,f32> for f32 {
#[inline(always)]
fn modulo(&self, other: &f32) -> f32 { *self % *other }
}

#[cfg(stage1,notest)]
#[cfg(stage2,notest)]
#[cfg(stage3,notest)]
impl Rem<f32,f32> for f32 {
#[inline(always)]
fn rem(&self, other: &f32) -> f32 { *self % *other }
}

#[cfg(notest)]
impl Neg<f32> for f32 {
#[inline(always)]
fn neg(&self) -> f32 { -*self }
}

Expand Down
9 changes: 9 additions & 0 deletions src/libcore/num/float.rs
Original file line number Diff line number Diff line change
Expand Up @@ -455,18 +455,25 @@ impl num::Round for float {
#[cfg(notest)]
impl Add<float,float> for float {
#[inline(always)]
fn add(&self, other: &float) -> float { *self + *other }
}
#[cfg(notest)]
impl Sub<float,float> for float {
#[inline(always)]
fn sub(&self, other: &float) -> float { *self - *other }
}
#[cfg(notest)]
impl Mul<float,float> for float {
#[inline(always)]
fn mul(&self, other: &float) -> float { *self * *other }
}
#[cfg(stage0,notest)]
impl Div<float,float> for float {
#[inline(always)]
fn div(&self, other: &float) -> float { *self / *other }
}
#[cfg(stage1,notest)]
Expand All @@ -478,6 +485,7 @@ impl Quot<float,float> for float {
}
#[cfg(stage0,notest)]
impl Modulo<float,float> for float {
#[inline(always)]
fn modulo(&self, other: &float) -> float { *self % *other }
}
#[cfg(stage1,notest)]
Expand All @@ -489,6 +497,7 @@ impl Rem<float,float> for float {
}
#[cfg(notest)]
impl Neg<float> for float {
#[inline(always)]
fn neg(&self) -> float { -*self }
}
Expand Down
18 changes: 18 additions & 0 deletions src/libcore/num/int-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -175,40 +175,53 @@ impl num::One for T {
#[cfg(notest)]
impl Add<T,T> for T {
#[inline(always)]
fn add(&self, other: &T) -> T { *self + *other }
}
#[cfg(notest)]
impl Sub<T,T> for T {
#[inline(always)]
fn sub(&self, other: &T) -> T { *self - *other }
}
#[cfg(notest)]
impl Mul<T,T> for T {
#[inline(always)]
fn mul(&self, other: &T) -> T { *self * *other }
}
#[cfg(stage0,notest)]
impl Div<T,T> for T {
#[inline(always)]
fn div(&self, other: &T) -> T { *self / *other }
}
#[cfg(stage1,notest)]
#[cfg(stage2,notest)]
#[cfg(stage3,notest)]
impl Quot<T,T> for T {
#[inline(always)]
fn quot(&self, other: &T) -> T { *self / *other }
}
#[cfg(stage0,notest)]
impl Modulo<T,T> for T {
#[inline(always)]
fn modulo(&self, other: &T) -> T { *self % *other }
}
#[cfg(stage1,notest)]
#[cfg(stage2,notest)]
#[cfg(stage3,notest)]
impl Rem<T,T> for T {
#[inline(always)]
fn rem(&self, other: &T) -> T { *self % *other }
}
#[cfg(notest)]
impl Neg<T> for T {
#[inline(always)]
fn neg(&self) -> T { -*self }
}
Expand All @@ -217,26 +230,31 @@ impl BitOr<T,T> for T {
#[inline(always)]
fn bitor(&self, other: &T) -> T { *self | *other }
}
#[cfg(notest)]
impl BitAnd<T,T> for T {
#[inline(always)]
fn bitand(&self, other: &T) -> T { *self & *other }
}
#[cfg(notest)]
impl BitXor<T,T> for T {
#[inline(always)]
fn bitxor(&self, other: &T) -> T { *self ^ *other }
}
#[cfg(notest)]
impl Shl<T,T> for T {
#[inline(always)]
fn shl(&self, other: &T) -> T { *self << *other }
}
#[cfg(notest)]
impl Shr<T,T> for T {
#[inline(always)]
fn shr(&self, other: &T) -> T { *self >> *other }
}
#[cfg(notest)]
impl Not<T> for T {
#[inline(always)]
Expand Down
18 changes: 18 additions & 0 deletions src/libcore/num/uint-template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,40 +140,53 @@ impl num::One for T {
#[cfg(notest)]
impl Add<T,T> for T {
#[inline(always)]
fn add(&self, other: &T) -> T { *self + *other }
}
#[cfg(notest)]
impl Sub<T,T> for T {
#[inline(always)]
fn sub(&self, other: &T) -> T { *self - *other }
}
#[cfg(notest)]
impl Mul<T,T> for T {
#[inline(always)]
fn mul(&self, other: &T) -> T { *self * *other }
}
#[cfg(stage0,notest)]
impl Div<T,T> for T {
#[inline(always)]
fn div(&self, other: &T) -> T { *self / *other }
}
#[cfg(stage1,notest)]
#[cfg(stage2,notest)]
#[cfg(stage3,notest)]
impl Quot<T,T> for T {
#[inline(always)]
fn quot(&self, other: &T) -> T { *self / *other }
}
#[cfg(stage0,notest)]
impl Modulo<T,T> for T {
#[inline(always)]
fn modulo(&self, other: &T) -> T { *self % *other }
}
#[cfg(stage1,notest)]
#[cfg(stage2,notest)]
#[cfg(stage3,notest)]
impl Rem<T,T> for T {
#[inline(always)]
fn rem(&self, other: &T) -> T { *self % *other }
}
#[cfg(notest)]
impl Neg<T> for T {
#[inline(always)]
fn neg(&self) -> T { -*self }
}
Expand All @@ -182,26 +195,31 @@ impl BitOr<T,T> for T {
#[inline(always)]
fn bitor(&self, other: &T) -> T { *self | *other }
}
#[cfg(notest)]
impl BitAnd<T,T> for T {
#[inline(always)]
fn bitand(&self, other: &T) -> T { *self & *other }
}
#[cfg(notest)]
impl BitXor<T,T> for T {
#[inline(always)]
fn bitxor(&self, other: &T) -> T { *self ^ *other }
}
#[cfg(notest)]
impl Shl<T,T> for T {
#[inline(always)]
fn shl(&self, other: &T) -> T { *self << *other }
}
#[cfg(notest)]
impl Shr<T,T> for T {
#[inline(always)]
fn shr(&self, other: &T) -> T { *self >> *other }
}
#[cfg(notest)]
impl Not<T> for T {
#[inline(always)]
Expand Down

0 comments on commit 0b90493

Please sign in to comment.