about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-04-23 13:56:49 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-04-23 14:05:41 -0400
commita3e33cfb6e6eddf0e47bc98fd46075fab30978e1 (patch)
treee2112426217b420dca6336590a368ff662fe6816
parent8cadcc47ee0413bdb1b52a594fbed3a3cae75705 (diff)
downloadrust-a3e33cfb6e6eddf0e47bc98fd46075fab30978e1.tar.gz
rust-a3e33cfb6e6eddf0e47bc98fd46075fab30978e1.zip
inline the primitive numeric operations
-rw-r--r--src/libcore/num/f32.rs13
-rw-r--r--src/libcore/num/float.rs9
-rw-r--r--src/libcore/num/int-template.rs18
-rw-r--r--src/libcore/num/uint-template.rs18
4 files changed, 58 insertions, 0 deletions
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index 2e7dc98e3c5..62004710196 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -301,20 +301,28 @@ 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)]
@@ -322,10 +330,13 @@ 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)]
@@ -333,8 +344,10 @@ 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 }
 }
 
diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs
index 9cf14cf0f49..c5c1e52a14c 100644
--- a/src/libcore/num/float.rs
+++ b/src/libcore/num/float.rs
@@ -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)]
@@ -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)]
@@ -489,6 +497,7 @@ impl Rem<float,float> for float {
 }
 #[cfg(notest)]
 impl Neg<float> for float {
+    #[inline(always)]
     fn neg(&self) -> float { -*self }
 }
 
diff --git a/src/libcore/num/int-template.rs b/src/libcore/num/int-template.rs
index 8f448994c98..684083f53e9 100644
--- a/src/libcore/num/int-template.rs
+++ b/src/libcore/num/int-template.rs
@@ -175,20 +175,28 @@ 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)]
@@ -196,10 +204,13 @@ 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)]
@@ -207,8 +218,10 @@ 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 }
 }
 
@@ -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)]
diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs
index 6f3f402f92d..4bb93907a3a 100644
--- a/src/libcore/num/uint-template.rs
+++ b/src/libcore/num/uint-template.rs
@@ -140,20 +140,28 @@ 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)]
@@ -161,10 +169,13 @@ 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)]
@@ -172,8 +183,10 @@ 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 }
 }
 
@@ -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)]