From 7e49f832415692c03e1658d8762c3ca2cd9cb7dc Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Thu, 2 May 2019 12:21:55 -0700 Subject: [PATCH] Add bindings for ldexp/ldexpf Should help in fixing wasmerio/wasmer#407 --- src/math/ldexp.rs | 5 +++++ src/math/ldexpf.rs | 5 +++++ src/math/mod.rs | 4 ++++ 3 files changed, 14 insertions(+) create mode 100644 src/math/ldexp.rs create mode 100644 src/math/ldexpf.rs diff --git a/src/math/ldexp.rs b/src/math/ldexp.rs new file mode 100644 index 0000000..780ddfc --- /dev/null +++ b/src/math/ldexp.rs @@ -0,0 +1,5 @@ +#[inline] +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn ldexp(x: f64, n: i32) -> f64 { + super::scalbn(x, n) +} diff --git a/src/math/ldexpf.rs b/src/math/ldexpf.rs new file mode 100644 index 0000000..70935a0 --- /dev/null +++ b/src/math/ldexpf.rs @@ -0,0 +1,5 @@ +#[inline] +#[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] +pub fn ldexpf(x: f32, n: i32) -> f32 { + super::scalbnf(x, n) +} diff --git a/src/math/mod.rs b/src/math/mod.rs index e51b151..be0918f 100644 --- a/src/math/mod.rs +++ b/src/math/mod.rs @@ -104,6 +104,8 @@ mod fmod; mod fmodf; mod hypot; mod hypotf; +mod ldexp; +mod ldexpf; mod log; mod log10; mod log10f; @@ -166,6 +168,8 @@ pub use self::fmod::fmod; pub use self::fmodf::fmodf; pub use self::hypot::hypot; pub use self::hypotf::hypotf; +pub use self::ldexp::ldexp; +pub use self::ldexpf::ldexpf; pub use self::log::log; pub use self::log10::log10; pub use self::log10f::log10f;