diff options
| author | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2013-04-18 23:24:24 +1000 |
|---|---|---|
| committer | Brendan Zabarauskas <bjzaba@yahoo.com.au> | 2013-04-18 23:24:24 +1000 |
| commit | 939a97f5cb4c8f44bc60784bbf4aa5d44f1c5dca (patch) | |
| tree | 1b64d1db3f3f04b0188283ee851434c430d98ac4 /src/libcore/num/float.rs | |
| parent | d2a81b95c3e2ccfdba0324caae531ce3528ed4e2 (diff) | |
| download | rust-939a97f5cb4c8f44bc60784bbf4aa5d44f1c5dca.tar.gz rust-939a97f5cb4c8f44bc60784bbf4aa5d44f1c5dca.zip | |
Add #[inline(always)] to each operator method
Diffstat (limited to 'src/libcore/num/float.rs')
| -rw-r--r-- | src/libcore/num/float.rs | 12 |
1 files changed, 12 insertions, 0 deletions
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 } } |
