about summary refs log tree commit diff
path: root/src/libcore/num
diff options
context:
space:
mode:
authorBrendan Zabarauskas <bjzaba@yahoo.com.au>2013-04-18 23:24:24 +1000
committerBrendan Zabarauskas <bjzaba@yahoo.com.au>2013-04-18 23:24:24 +1000
commit939a97f5cb4c8f44bc60784bbf4aa5d44f1c5dca (patch)
tree1b64d1db3f3f04b0188283ee851434c430d98ac4 /src/libcore/num
parentd2a81b95c3e2ccfdba0324caae531ce3528ed4e2 (diff)
downloadrust-939a97f5cb4c8f44bc60784bbf4aa5d44f1c5dca.tar.gz
rust-939a97f5cb4c8f44bc60784bbf4aa5d44f1c5dca.zip
Add #[inline(always)] to each operator method
Diffstat (limited to 'src/libcore/num')
-rw-r--r--src/libcore/num/f32.rs6
-rw-r--r--src/libcore/num/f64.rs6
-rw-r--r--src/libcore/num/float.rs12
-rw-r--r--src/libcore/num/int-template.rs13
-rw-r--r--src/libcore/num/uint-template.rs13
5 files changed, 50 insertions, 0 deletions
diff --git a/src/libcore/num/f32.rs b/src/libcore/num/f32.rs
index 5e672ea0dfa..404f1a82de5 100644
--- a/src/libcore/num/f32.rs
+++ b/src/libcore/num/f32.rs
@@ -288,26 +288,32 @@ impl num::One for f32 {
 
 #[cfg(notest)]
 impl ops::Add<f32,f32> for f32 {
+    #[inline(always)]
     fn add(&self, other: &f32) -> f32 { *self + *other }
 }
 #[cfg(notest)]
 impl ops::Sub<f32,f32> for f32 {
+    #[inline(always)]
     fn sub(&self, other: &f32) -> f32 { *self - *other }
 }
 #[cfg(notest)]
 impl ops::Mul<f32,f32> for f32 {
+    #[inline(always)]
     fn mul(&self, other: &f32) -> f32 { *self * *other }
 }
 #[cfg(notest)]
 impl ops::Div<f32,f32> for f32 {
+    #[inline(always)]
     fn div(&self, other: &f32) -> f32 { *self / *other }
 }
 #[cfg(notest)]
 impl ops::Modulo<f32,f32> for f32 {
+    #[inline(always)]
     fn modulo(&self, other: &f32) -> f32 { *self % *other }
 }
 #[cfg(notest)]
 impl ops::Neg<f32> for f32 {
+    #[inline(always)]
     fn neg(&self) -> f32 { -*self }
 }
 
diff --git a/src/libcore/num/f64.rs b/src/libcore/num/f64.rs
index 4c96da73d21..b4eaa0e7fdc 100644
--- a/src/libcore/num/f64.rs
+++ b/src/libcore/num/f64.rs
@@ -310,26 +310,32 @@ impl num::One for f64 {
 
 #[cfg(notest)]
 impl ops::Add<f64,f64> for f64 {
+    #[inline(always)]
     fn add(&self, other: &f64) -> f64 { *self + *other }
 }
 #[cfg(notest)]
 impl ops::Sub<f64,f64> for f64 {
+    #[inline(always)]
     fn sub(&self, other: &f64) -> f64 { *self - *other }
 }
 #[cfg(notest)]
 impl ops::Mul<f64,f64> for f64 {
+    #[inline(always)]
     fn mul(&self, other: &f64) -> f64 { *self * *other }
 }
 #[cfg(notest)]
 impl ops::Div<f64,f64> for f64 {
+    #[inline(always)]
     fn div(&self, other: &f64) -> f64 { *self / *other }
 }
 #[cfg(notest)]
 impl ops::Modulo<f64,f64> for f64 {
+    #[inline(always)]
     fn modulo(&self, other: &f64) -> f64 { *self % *other }
 }
 #[cfg(notest)]
 impl ops::Neg<f64> for f64 {
+    #[inline(always)]
     fn neg(&self) -> f64 { -*self }
 }
 
diff --git a/src/libcore/num/float.rs b/src/libcore/num/float.rs
index 488756787b5..42f0f033ac2 100644
--- a/src/libcore/num/float.rs
+++ b/src/libcore/num/float.rs
@@ -387,15 +387,21 @@ pub fn tan(x: float) -> float {
 
 #[cfg(notest)]
 impl Eq for float {
+    #[inline(always)]
     fn eq(&self, other: &float) -> bool { (*self) == (*other) }
+    #[inline(always)]
     fn ne(&self, other: &float) -> bool { (*self) != (*other) }
 }
 
 #[cfg(notest)]
 impl Ord for float {
+    #[inline(always)]
     fn lt(&self, other: &float) -> bool { (*self) < (*other) }
+    #[inline(always)]
     fn le(&self, other: &float) -> bool { (*self) <= (*other) }
+    #[inline(always)]
     fn ge(&self, other: &float) -> bool { (*self) >= (*other) }
+    #[inline(always)]
     fn gt(&self, other: &float) -> bool { (*self) > (*other) }
 }
 
@@ -444,26 +450,32 @@ impl num::Round for float {
 
 #[cfg(notest)]
 impl ops::Add<float,float> for float {
+    #[inline(always)]
     fn add(&self, other: &float) -> float { *self + *other }
 }
 #[cfg(notest)]
 impl ops::Sub<float,float> for float {
+    #[inline(always)]
     fn sub(&self, other: &float) -> float { *self - *other }
 }
 #[cfg(notest)]
 impl ops::Mul<float,float> for float {
+    #[inline(always)]
     fn mul(&self, other: &float) -> float { *self * *other }
 }
 #[cfg(notest)]
 impl ops::Div<float,float> for float {
+    #[inline(always)]
     fn div(&self, other: &float) -> float { *self / *other }
 }
 #[cfg(notest)]
 impl ops::Modulo<float,float> for float {
+    #[inline(always)]
     fn modulo(&self, other: &float) -> float { *self % *other }
 }
 #[cfg(notest)]
 impl ops::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 f901e591027..044c62e92c1 100644
--- a/src/libcore/num/int-template.rs
+++ b/src/libcore/num/int-template.rs
@@ -177,50 +177,63 @@ impl num::One for T {
 
 #[cfg(notest)]
 impl ops::Add<T,T> for T {
+    #[inline(always)]
     fn add(&self, other: &T) -> T { *self + *other }
 }
 #[cfg(notest)]
 impl ops::Sub<T,T> for T {
+    #[inline(always)]
     fn sub(&self, other: &T) -> T { *self - *other }
 }
 #[cfg(notest)]
 impl ops::Mul<T,T> for T {
+    #[inline(always)]
     fn mul(&self, other: &T) -> T { *self * *other }
 }
 #[cfg(notest)]
 impl ops::Div<T,T> for T {
+    #[inline(always)]
     fn div(&self, other: &T) -> T { *self / *other }
 }
 #[cfg(notest)]
 impl ops::Modulo<T,T> for T {
+    #[inline(always)]
     fn modulo(&self, other: &T) -> T { *self % *other }
 }
 #[cfg(notest)]
 impl ops::Neg<T> for T {
+    #[inline(always)]
     fn neg(&self) -> T { -*self }
 }
+
 #[cfg(notest)]
 impl ops::BitOr<T,T> for T {
+    #[inline(always)]
     fn bitor(&self, other: &T) -> T { *self | *other }
 }
 #[cfg(notest)]
 impl ops::BitAnd<T,T> for T {
+    #[inline(always)]
     fn bitand(&self, other: &T) -> T { *self & *other }
 }
 #[cfg(notest)]
 impl ops::BitXor<T,T> for T {
+    #[inline(always)]
     fn bitxor(&self, other: &T) -> T { *self ^ *other }
 }
 #[cfg(notest)]
 impl ops::Shl<T,T> for T {
+    #[inline(always)]
     fn shl(&self, other: &T) -> T { *self << *other }
 }
 #[cfg(notest)]
 impl ops::Shr<T,T> for T {
+    #[inline(always)]
     fn shr(&self, other: &T) -> T { *self >> *other }
 }
 #[cfg(notest)]
 impl ops::Not<T> for T {
+    #[inline(always)]
     fn not(&self) -> T { !*self }
 }
 
diff --git a/src/libcore/num/uint-template.rs b/src/libcore/num/uint-template.rs
index 34c11804af4..b49ec65a95b 100644
--- a/src/libcore/num/uint-template.rs
+++ b/src/libcore/num/uint-template.rs
@@ -142,50 +142,63 @@ impl num::One for T {
 
 #[cfg(notest)]
 impl ops::Add<T,T> for T {
+    #[inline(always)]
     fn add(&self, other: &T) -> T { *self + *other }
 }
 #[cfg(notest)]
 impl ops::Sub<T,T> for T {
+    #[inline(always)]
     fn sub(&self, other: &T) -> T { *self - *other }
 }
 #[cfg(notest)]
 impl ops::Mul<T,T> for T {
+    #[inline(always)]
     fn mul(&self, other: &T) -> T { *self * *other }
 }
 #[cfg(notest)]
 impl ops::Div<T,T> for T {
+    #[inline(always)]
     fn div(&self, other: &T) -> T { *self / *other }
 }
 #[cfg(notest)]
 impl ops::Modulo<T,T> for T {
+    #[inline(always)]
     fn modulo(&self, other: &T) -> T { *self % *other }
 }
 #[cfg(notest)]
 impl ops::Neg<T> for T {
+    #[inline(always)]
     fn neg(&self) -> T { -*self }
 }
+
 #[cfg(notest)]
 impl ops::BitOr<T,T> for T {
+    #[inline(always)]
     fn bitor(&self, other: &T) -> T { *self | *other }
 }
 #[cfg(notest)]
 impl ops::BitAnd<T,T> for T {
+    #[inline(always)]
     fn bitand(&self, other: &T) -> T { *self & *other }
 }
 #[cfg(notest)]
 impl ops::BitXor<T,T> for T {
+    #[inline(always)]
     fn bitxor(&self, other: &T) -> T { *self ^ *other }
 }
 #[cfg(notest)]
 impl ops::Shl<T,T> for T {
+    #[inline(always)]
     fn shl(&self, other: &T) -> T { *self << *other }
 }
 #[cfg(notest)]
 impl ops::Shr<T,T> for T {
+    #[inline(always)]
     fn shr(&self, other: &T) -> T { *self >> *other }
 }
 #[cfg(notest)]
 impl ops::Not<T> for T {
+    #[inline(always)]
     fn not(&self) -> T { !*self }
 }