Skip to content
Snippets Groups Projects
Commit ed99c9d0 authored by mattijs's avatar mattijs
Browse files

ENH: sigFpe: use std::signalling_nan

parent 7b19a545
Branches
Tags
No related merge requests found
...@@ -45,6 +45,7 @@ License ...@@ -45,6 +45,7 @@ License
#endif #endif
#include <stdint.h> #include <stdint.h>
#include <limits>
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
...@@ -53,26 +54,7 @@ struct sigaction Foam::sigFpe::oldAction_; ...@@ -53,26 +54,7 @@ struct sigaction Foam::sigFpe::oldAction_;
void Foam::sigFpe::fillSignallingNan(UList<scalar>& lst) void Foam::sigFpe::fillSignallingNan(UList<scalar>& lst)
{ {
#ifdef LINUX lst = std::numeric_limits<scalar>::signaling_NaN();
// initialize to signalling NaN
# ifdef WM_SP
const uint32_t sNAN = 0x7ff7fffflu;
uint32_t* dPtr = reinterpret_cast<uint32_t*>(lst.begin());
# else
const uint64_t sNAN = 0x7ff7ffffffffffffllu;
uint64_t* dPtr = reinterpret_cast<uint64_t*>(lst.begin());
# endif
forAll(lst, i)
{
*dPtr++ = sNAN;
}
#endif
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment