summaryrefslogtreecommitdiffstats
path: root/vendor/libm/src/math/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/libm/src/math/mod.rs')
-rw-r--r--vendor/libm/src/math/mod.rs40
1 files changed, 34 insertions, 6 deletions
diff --git a/vendor/libm/src/math/mod.rs b/vendor/libm/src/math/mod.rs
index 35ffe1a2c..05ebb708c 100644
--- a/vendor/libm/src/math/mod.rs
+++ b/vendor/libm/src/math/mod.rs
@@ -1,12 +1,10 @@
macro_rules! force_eval {
($e:expr) => {
- unsafe {
- ::core::ptr::read_volatile(&$e);
- }
+ unsafe { ::core::ptr::read_volatile(&$e) }
};
}
-#[cfg(not(feature = "checked"))]
+#[cfg(not(debug_assertions))]
macro_rules! i {
($array:expr, $index:expr) => {
unsafe { *$array.get_unchecked($index) }
@@ -36,7 +34,7 @@ macro_rules! i {
};
}
-#[cfg(feature = "checked")]
+#[cfg(debug_assertions)]
macro_rules! i {
($array:expr, $index:expr) => {
*$array.get($index).unwrap()
@@ -58,9 +56,27 @@ macro_rules! i {
};
}
+// Temporary macro to avoid panic codegen for division (in debug mode too). At
+// the time of this writing this is only used in a few places, and once
+// rust-lang/rust#72751 is fixed then this macro will no longer be necessary and
+// the native `/` operator can be used and panics won't be codegen'd.
+#[cfg(any(debug_assertions, not(feature = "unstable")))]
+macro_rules! div {
+ ($a:expr, $b:expr) => {
+ $a / $b
+ };
+}
+
+#[cfg(all(not(debug_assertions), feature = "unstable"))]
+macro_rules! div {
+ ($a:expr, $b:expr) => {
+ unsafe { core::intrinsics::unchecked_div($a, $b) }
+ };
+}
+
macro_rules! llvm_intrinsically_optimized {
(#[cfg($($clause:tt)*)] $e:expr) => {
- #[cfg(all(not(feature = "stable"), $($clause)*))]
+ #[cfg(all(feature = "unstable", $($clause)*))]
{
if true { // thwart the dead code lint
$e
@@ -146,10 +162,16 @@ mod log2f;
mod logf;
mod modf;
mod modff;
+mod nextafter;
+mod nextafterf;
mod pow;
mod powf;
+mod remainder;
+mod remainderf;
mod remquo;
mod remquof;
+mod rint;
+mod rintf;
mod round;
mod roundf;
mod scalbn;
@@ -256,10 +278,16 @@ pub use self::log2f::log2f;
pub use self::logf::logf;
pub use self::modf::modf;
pub use self::modff::modff;
+pub use self::nextafter::nextafter;
+pub use self::nextafterf::nextafterf;
pub use self::pow::pow;
pub use self::powf::powf;
+pub use self::remainder::remainder;
+pub use self::remainderf::remainderf;
pub use self::remquo::remquo;
pub use self::remquof::remquof;
+pub use self::rint::rint;
+pub use self::rintf::rintf;
pub use self::round::round;
pub use self::roundf::roundf;
pub use self::scalbn::scalbn;