diff options
Diffstat (limited to 'src/libstd/num')
| -rw-r--r-- | src/libstd/num/f32.rs | 5 | ||||
| -rw-r--r-- | src/libstd/num/f64.rs | 7 |
2 files changed, 10 insertions, 2 deletions
diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index 624748f352e..94aa3d6b513 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -646,7 +646,10 @@ impl f32 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn log2(self) -> f32 { - unsafe { intrinsics::log2f32(self) } + #[cfg(target_os = "android")] + return ::sys::android::log2f32(self); + #[cfg(not(target_os = "android"))] + return unsafe { intrinsics::log2f32(self) }; } /// Returns the base 10 logarithm of the number. diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 6515301aefd..2beffb64d3d 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -546,7 +546,12 @@ impl f64 { #[stable(feature = "rust1", since = "1.0.0")] #[inline] pub fn log2(self) -> f64 { - self.log_wrapper(|n| { unsafe { intrinsics::log2f64(n) } }) + self.log_wrapper(|n| { + #[cfg(target_os = "android")] + return ::sys::android::log2f64(n); + #[cfg(not(target_os = "android"))] + return unsafe { intrinsics::log2f64(n) }; + }) } /// Returns the base 10 logarithm of the number. |
