about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorTim Chevalier <chevalier@alum.wellesley.edu>2012-11-24 09:01:23 -0800
committerTim Chevalier <chevalier@alum.wellesley.edu>2012-11-24 09:01:23 -0800
commit55ca36196de2b39c819bf75ca7727d2b3d937ec8 (patch)
tree9f9e847d9388527a7509e2ec8d517d1555116050 /src
parent626a7aa4f4cafde876d4a0ed3523a3e90ff4c066 (diff)
parentc961d214d9519a03ee4c2f153f01a1eeb5e34bdb (diff)
downloadrust-55ca36196de2b39c819bf75ca7727d2b3d937ec8.tar.gz
rust-55ca36196de2b39c819bf75ca7727d2b3d937ec8.zip
Merge pull request #4026 from eholk/float-perf
Inline numeric operations for floats.
Diffstat (limited to 'src')
-rw-r--r--src/libcore/float.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/libcore/float.rs b/src/libcore/float.rs
index cfddfaa00e2..1e218f1cba3 100644
--- a/src/libcore/float.rs
+++ b/src/libcore/float.rs
@@ -436,14 +436,22 @@ impl float : Ord {
 }
 
 impl float: num::Num {
+    #[inline(always)]
     pub pure fn add(other: &float)    -> float { return self + *other; }
+    #[inline(always)]
     pub pure fn sub(other: &float)    -> float { return self - *other; }
+    #[inline(always)]
     pub pure fn mul(other: &float)    -> float { return self * *other; }
+    #[inline(always)]
     pub pure fn div(other: &float)    -> float { return self / *other; }
+    #[inline(always)]
     pure fn modulo(other: &float) -> float { return self % *other; }
+    #[inline(always)]
     pure fn neg()                  -> float { return -self;        }
 
+    #[inline(always)]
     pure fn to_int()         -> int   { return self as int; }
+    #[inline(always)]
     static pure fn from_int(n: int) -> float { return n as float;  }
 }