about summary refs log tree commit diff
path: root/src/libstd/num
diff options
context:
space:
mode:
authorRicky Taylor <rickytaylor26@gmail.com>2015-03-04 22:58:59 +0000
committerAlex Crichton <alex@alexcrichton.com>2015-05-12 14:50:36 -0700
commit315750ac92a8114a96b35352ec88f82d21d5fbec (patch)
treef5ac24a5c9dd7d603909509c0b3c590ca00abab9 /src/libstd/num
parent3ca008dcf12283247122f25928630f2a484ff768 (diff)
downloadrust-315750ac92a8114a96b35352ec88f82d21d5fbec.tar.gz
rust-315750ac92a8114a96b35352ec88f82d21d5fbec.zip
Very hacky MSVC hacks.
Conflicts:
	mk/platform.mk
	src/librustc/session/config.rs
	src/librustc_back/target/aarch64_apple_ios.rs
	src/librustc_back/target/aarch64_linux_android.rs
	src/librustc_back/target/arm_linux_androideabi.rs
	src/librustc_back/target/arm_unknown_linux_gnueabi.rs
	src/librustc_back/target/arm_unknown_linux_gnueabihf.rs
	src/librustc_back/target/armv7_apple_ios.rs
	src/librustc_back/target/armv7s_apple_ios.rs
	src/librustc_back/target/i386_apple_ios.rs
	src/librustc_back/target/i686_apple_darwin.rs
	src/librustc_back/target/i686_pc_windows_gnu.rs
	src/librustc_back/target/i686_unknown_dragonfly.rs
	src/librustc_back/target/i686_unknown_linux_gnu.rs
	src/librustc_back/target/mips_unknown_linux_gnu.rs
	src/librustc_back/target/mipsel_unknown_linux_gnu.rs
	src/librustc_back/target/mod.rs
	src/librustc_back/target/powerpc_unknown_linux_gnu.rs
	src/librustc_back/target/x86_64_apple_darwin.rs
	src/librustc_back/target/x86_64_apple_ios.rs
	src/librustc_back/target/x86_64_pc_windows_gnu.rs
	src/librustc_back/target/x86_64_unknown_dragonfly.rs
	src/librustc_back/target/x86_64_unknown_freebsd.rs
	src/librustc_back/target/x86_64_unknown_linux_gnu.rs
	src/librustc_back/target/x86_64_unknown_openbsd.rs
	src/librustc_llvm/lib.rs
	src/librustc_trans/back/link.rs
	src/librustc_trans/trans/base.rs
	src/libstd/os.rs
	src/rustllvm/RustWrapper.cpp
Diffstat (limited to 'src/libstd/num')
-rw-r--r--src/libstd/num/f32.rs27
-rw-r--r--src/libstd/num/f64.rs8
2 files changed, 31 insertions, 4 deletions
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs
index 1ee3aab2727..934cf056ec1 100644
--- a/src/libstd/num/f32.rs
+++ b/src/libstd/num/f32.rs
@@ -31,6 +31,8 @@ pub use core::f32::consts;
 #[allow(dead_code)]
 mod cmath {
     use libc::{c_float, c_int};
+    #[cfg(windows)]
+    use libc::c_double;
 
     #[link_name = "m"]
     extern {
@@ -44,13 +46,10 @@ mod cmath {
         pub fn erfcf(n: c_float) -> c_float;
         pub fn expm1f(n: c_float) -> c_float;
         pub fn fdimf(a: c_float, b: c_float) -> c_float;
-        pub fn frexpf(n: c_float, value: &mut c_int) -> c_float;
         pub fn fmaxf(a: c_float, b: c_float) -> c_float;
         pub fn fminf(a: c_float, b: c_float) -> c_float;
         pub fn fmodf(a: c_float, b: c_float) -> c_float;
         pub fn nextafterf(x: c_float, y: c_float) -> c_float;
-        pub fn hypotf(x: c_float, y: c_float) -> c_float;
-        pub fn ldexpf(x: c_float, n: c_int) -> c_float;
         pub fn logbf(n: c_float) -> c_float;
         pub fn log1pf(n: c_float) -> c_float;
         pub fn ilogbf(n: c_float) -> c_int;
@@ -62,11 +61,33 @@ mod cmath {
 
         #[cfg(unix)]
         pub fn lgammaf_r(n: c_float, sign: &mut c_int) -> c_float;
+        #[cfg(unix)]
+        pub fn hypotf(x: c_float, y: c_float) -> c_float;
+        #[cfg(unix)]
+        pub fn frexpf(n: c_float, value: &mut c_int) -> c_float;
+        #[cfg(unix)]
+        pub fn ldexpf(x: c_float, n: c_int) -> c_float;
 
         #[cfg(windows)]
         #[link_name="__lgammaf_r"]
         pub fn lgammaf_r(n: c_float, sign: &mut c_int) -> c_float;
+
+        #[cfg(windows)]
+        #[link_name="_hypotf"]
+        pub fn hypotf(x: c_float, y: c_float) -> c_float;
+
+        #[cfg(windows)]
+        fn frexp(n: c_double, value: &mut c_int) -> c_double;
+
+        #[cfg(windows)]
+        fn ldexp(x: c_double, n: c_int) -> c_double;
     }
+
+    #[cfg(windows)]
+    pub unsafe fn ldexpf(x: c_float, n: c_int) -> c_float { return ldexp(x as c_double, n) as c_float; }
+
+    #[cfg(windows)]
+    pub unsafe fn frexpf(x: c_float, value: &mut c_int) -> c_float { return frexp(x as c_double, value) as c_float; }
 }
 
 #[cfg(not(test))]
diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs
index 398afcb553c..a09a82b8552 100644
--- a/src/libstd/num/f64.rs
+++ b/src/libstd/num/f64.rs
@@ -48,7 +48,6 @@ mod cmath {
         pub fn fmod(a: c_double, b: c_double) -> c_double;
         pub fn nextafter(x: c_double, y: c_double) -> c_double;
         pub fn frexp(n: c_double, value: &mut c_int) -> c_double;
-        pub fn hypot(x: c_double, y: c_double) -> c_double;
         pub fn ldexp(x: c_double, n: c_int) -> c_double;
         pub fn logb(n: c_double) -> c_double;
         pub fn log1p(n: c_double) -> c_double;
@@ -74,6 +73,13 @@ mod cmath {
         #[cfg(windows)]
         #[link_name="__lgamma_r"]
         pub fn lgamma_r(n: c_double, sign: &mut c_int) -> c_double;
+
+        #[cfg(unix)]
+        pub fn hypot(x: c_double, y: c_double) -> c_double;
+
+        #[cfg(windows)]
+        #[link_name="_hypot"]
+        pub fn hypot(x: c_double, y: c_double) -> c_double;
     }
 }