diff options
Diffstat (limited to 'lang/rust/files/log2.patch')
-rw-r--r-- | lang/rust/files/log2.patch | 82 |
1 files changed, 50 insertions, 32 deletions
diff --git a/lang/rust/files/log2.patch b/lang/rust/files/log2.patch index ed0b307f6a6..d6054b3b5ef 100644 --- a/lang/rust/files/log2.patch +++ b/lang/rust/files/log2.patch @@ -1,48 +1,66 @@ ---- src/libcore/cmath.rs.orig 2012-10-16 21:22:12.704922039 +0800 -+++ src/libcore/cmath.rs 2012-10-16 21:23:23.023337237 +0800 -@@ -56,7 +56,6 @@ - // renamed: to be consitent with log as ln - #[link_name="log1p"] pure fn ln1p(n: c_double) -> c_double; - pure fn log10(n: c_double) -> c_double; -- pure fn log2(n: c_double) -> c_double; - #[link_name="ilogb"] pure fn ilog_radix(n: c_double) -> c_int; - pure fn modf(n: c_double, iptr: &mut c_double) -> c_double; - pure fn pow(n: c_double, e: c_double) -> c_double; -@@ -131,7 +130,6 @@ - #[link_name="logf"] pure fn ln(n: c_float) -> c_float; - #[link_name="logbf"] pure fn log_radix(n: c_float) -> c_float; - #[link_name="log1pf"] pure fn ln1p(n: c_float) -> c_float; -- #[link_name="log2f"] pure fn log2(n: c_float) -> c_float; - #[link_name="log10f"] pure fn log10(n: c_float) -> c_float; - #[link_name="ilogbf"] pure fn ilog_radix(n: c_float) -> c_int; - #[link_name="modff"] pure fn modf(n: c_float, ---- src/libcore/f32.rs.orig 2012-10-16 21:22:27.909922315 +0800 -+++ src/libcore/f32.rs 2012-10-16 21:24:32.932336957 +0800 -@@ -135,7 +135,11 @@ - } +--- src/libcore/num/cmath.rs.orig 2013-04-06 12:52:09.596039132 +0800 ++++ src/libcore/num/cmath.rs 2013-04-06 12:53:24.474452681 +0800 +@@ -64,7 +64,6 @@ + // renamed: to be consitent with log as ln + #[link_name="log1p"] unsafe fn ln1p(n: c_double) -> c_double; + unsafe fn log10(n: c_double) -> c_double; +- unsafe fn log2(n: c_double) -> c_double; + #[link_name="ilogb"] unsafe fn ilog_radix(n: c_double) -> c_int; + unsafe fn modf(n: c_double, iptr: &mut c_double) -> c_double; + unsafe fn pow(n: c_double, e: c_double) -> c_double; +@@ -148,7 +147,6 @@ + #[link_name="logf"] unsafe fn ln(n: c_float) -> c_float; + #[link_name="logbf"] unsafe fn log_radix(n: c_float) -> c_float; + #[link_name="log1pf"] unsafe fn ln1p(n: c_float) -> c_float; +- #[link_name="log2f"] unsafe fn log2(n: c_float) -> c_float; + #[link_name="log10f"] unsafe fn log10(n: c_float) -> c_float; + #[link_name="ilogbf"] unsafe fn ilog_radix(n: c_float) -> c_int; + #[link_name="modff"] unsafe fn modf(n: c_float, +--- src/libcore/num/f32.rs.orig 2013-04-06 12:52:15.395037527 +0800 ++++ src/libcore/num/f32.rs 2013-04-06 13:00:55.623679761 +0800 +@@ -81,7 +81,6 @@ + cmath::c_float_utils::log_radix) + delegate!(fn ln1p(n: c_float) -> c_float = cmath::c_float_utils::ln1p) + delegate!(fn log10(n: c_float) -> c_float = cmath::c_float_utils::log10) +-delegate!(fn log2(n: c_float) -> c_float = cmath::c_float_utils::log2) + delegate!(fn ilog_radix(n: c_float) -> c_int = + cmath::c_float_utils::ilog_radix) + delegate!(fn modf(n: c_float, iptr: &mut c_float) -> c_float = +@@ -254,7 +253,12 @@ - pub pure fn logarithm(n: f32, b: f32) -> f32 { + #[inline(always)] + pub fn logarithm(n: f32, b: f32) -> f32 { - return log2(n) / log2(b); + return ln(n) / ln(b); +} + -+pub pure fn log2(n: f32) -> f32 { ++#[inline(always)] ++pub fn log2(n: f32) -> f32 { + return ln(n) / consts::ln_2; } - impl f32: num::Num { ---- src/libcore/f64.rs.orig 2012-10-16 21:22:34.895921647 +0800 -+++ src/libcore/f64.rs 2012-10-16 21:25:30.466586496 +0800 -@@ -154,7 +154,11 @@ - } + #[cfg(notest)] +--- src/libcore/num/f64.rs.orig 2013-04-06 12:52:25.866037307 +0800 ++++ src/libcore/num/f64.rs 2013-04-06 13:02:33.051357016 +0800 +@@ -82,7 +82,6 @@ + cmath::c_double_utils::log_radix) + delegate!(fn ln1p(n: c_double) -> c_double = cmath::c_double_utils::ln1p) + delegate!(fn log10(n: c_double) -> c_double = cmath::c_double_utils::log10) +-delegate!(fn log2(n: c_double) -> c_double = cmath::c_double_utils::log2) + delegate!(fn ilog_radix(n: c_double) -> c_int = + cmath::c_double_utils::ilog_radix) + delegate!(fn modf(n: c_double, iptr: &mut c_double) -> c_double = +@@ -276,7 +275,12 @@ - pub pure fn logarithm(n: f64, b: f64) -> f64 { + #[inline(always)] + pub fn logarithm(n: f64, b: f64) -> f64 { - return log2(n) / log2(b); + return ln(n) / ln(b); +} + -+pub pure fn log2(n: f64) -> f64 { ++#[inline(always)] ++pub fn log2(n: f64) -> f64 { + return ln(n) / consts::ln_2; } - impl f64: num::Num { + #[cfg(notest)] |