aboutsummaryrefslogtreecommitdiffstats
path: root/lang/rust/files/log2.patch
diff options
context:
space:
mode:
Diffstat (limited to 'lang/rust/files/log2.patch')
-rw-r--r--lang/rust/files/log2.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/lang/rust/files/log2.patch b/lang/rust/files/log2.patch
new file mode 100644
index 000000000000..ed0b307f6a66
--- /dev/null
+++ b/lang/rust/files/log2.patch
@@ -0,0 +1,48 @@
+--- 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 @@
+ }
+
+ pub pure fn logarithm(n: f32, b: f32) -> f32 {
+- return log2(n) / log2(b);
++ return ln(n) / ln(b);
++}
++
++pub pure 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 @@
+ }
+
+ pub pure fn logarithm(n: f64, b: f64) -> f64 {
+- return log2(n) / log2(b);
++ return ln(n) / ln(b);
++}
++
++pub pure fn log2(n: f64) -> f64 {
++ return ln(n) / consts::ln_2;
+ }
+
+ impl f64: num::Num {