From 1a2cff6d14b3eaf6f26a1efc1514c3ae151515cb Mon Sep 17 00:00:00 2001 From: John Maddock Date: Tue, 3 Apr 2001 11:26:20 +0000 Subject: [PATCH] Updated limits.hpp for BeOS support [SVN r9696] --- include/boost/detail/limits.hpp | 28 ++++++++++++++++------------ 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/include/boost/detail/limits.hpp b/include/boost/detail/limits.hpp index 6ed7ad05..85901c53 100644 --- a/include/boost/detail/limits.hpp +++ b/include/boost/detail/limits.hpp @@ -152,6 +152,18 @@ public: BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, true); }; + template + struct float_helper{ + static __number __get_word() throw() { + // sizeof(long double) == 12, but only 10 bytes significant + const unsigned int _S_word[4] = { 0, 0, 0, __Word }; + return *reinterpret_cast( + reinterpret_cast(&_S_word)+16- + (sizeof(__number) == 12 ? 10 : sizeof(__number))); + } +}; + + // Base class for floating-point numbers. template - static __number __get_word() throw() { - // sizeof(long double) == 12, but only 10 bytes significant - const unsigned int _S_word[4] = { 0, 0, 0, __Word }; - return *reinterpret_cast( - reinterpret_cast(&_S_word)+16- - (sizeof(__number) == 12 ? 10 : sizeof(__number))); - } - + static __number infinity() throw() { - return __get_word<__InfinityWord>(); + return float_helper<__number, __InfinityWord>::__get_word(); } static __number quiet_NaN() throw() { - return __get_word<__QNaNWord>(); + return float_helper<__number,__QNaNWord>::__get_word(); } static __number signaling_NaN() throw() { - return __get_word<__SNaNWord>(); + return float_helper<__number,__SNaNWord>::__get_word(); } BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, __IsIEC559);