提交 55ca3619 编写于 作者: T Tim Chevalier

Merge pull request #4026 from eholk/float-perf

Inline numeric operations for floats.
......@@ -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; }
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册