rust ffast-math (defunct, use lower)
| -rw-r--r-- | src/lib.rs | 8 | ||||
| -rw-r--r-- | src/trait.rs | 3 |
2 files changed, 9 insertions, 2 deletions
@@ -61,7 +61,13 @@ impl<T: FastFloat> FFloat<T> { } fn check(self) { - debug_assert!(!self.bad(), "{self} is NAN | INF."); + if self.bad() { + if cfg!(debug_assertions) { + panic!("{self} is NAN | INF."); + } else { + unsafe { core::hint::unreachable_unchecked() }; + } + } } } diff --git a/src/trait.rs b/src/trait.rs index 74b0a5a..7717cd6 100644 --- a/src/trait.rs +++ b/src/trait.rs @@ -14,7 +14,7 @@ macro_rules! meth { $name(a, b) })+ - + #[inline(always)] fn bad(self) -> bool { self.is_nan() || self.is_infinite() } } @@ -23,6 +23,7 @@ macro_rules! meth { $name(a, b) })+ + #[inline(always)] fn bad(self) -> bool { self.is_nan() || self.is_infinite() } } }; |