Skip to content

Commit 95bec47

Browse files
committed
Rewrote the test for long double bits to avoid platform specific code.
1 parent f0fba03 commit 95bec47

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/vsg/maths/common.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLI
1313

1414
#include <vsg/maths/common.h>
1515

16+
#include <float.h>
17+
1618
uint32_t vsg::native_long_double_bits()
1719
{
18-
#if defined(_MSC_VER)
19-
return 64;
20-
#elif defined(__GNUC__) || defined(__clang__)
21-
if (typeid(long double)==typeid(__float80)) return 80;
22-
if (typeid(long double)==typeid(__float128)) return 128;
23-
if (typeid(long double)==typeid(double)) return 64;
24-
#endif
25-
return (sizeof(long double)==8) ? 64 : 128;
20+
if (LDBL_MANT_DIG == DBL_MANT_DIG) return 64;
21+
return LDBL_MANT_DIG <= 64 ? 80 : 128;
2622
}

0 commit comments

Comments
 (0)