From f1bfe4cc64218d015a8415b37b30127327df8b39 Mon Sep 17 00:00:00 2001 From: "arseny.kapoulkine" Date: Mon, 31 May 2010 07:56:13 +0000 Subject: Simplified fp specials handling in XPath (using common faster implementation for both MSVC and BCC) git-svn-id: http://pugixml.googlecode.com/svn/trunk@480 99668b35-9821-0410-8761-19e4c4f06640 --- src/pugixpath.cpp | 27 +++------------------------ 1 file changed, 3 insertions(+), 24 deletions(-) (limited to 'src') diff --git a/src/pugixpath.cpp b/src/pugixpath.cpp index f0d3706..832e18b 100644 --- a/src/pugixpath.cpp +++ b/src/pugixpath.cpp @@ -297,31 +297,10 @@ namespace const char_t* convert_number_to_string_special(double value) { - #if defined(_MSC_VER) - switch (_fpclass(value)) - { - case _FPCLASS_SNAN: - case _FPCLASS_QNAN: - return PUGIXML_TEXT("NaN"); - - case _FPCLASS_NINF: - return PUGIXML_TEXT("-Infinity"); - - case _FPCLASS_NZ: - case _FPCLASS_PZ: - return PUGIXML_TEXT("0"); - - case _FPCLASS_PINF: - return PUGIXML_TEXT("Infinity"); - - default: - return 0; - } - #elif defined(__BORLANDC__) // _fpclass in BorlandC breaks fp flags + #if defined(_MSC_VER) || defined(__BORLANDC__) + if (_finite(value)) return (value == 0) ? PUGIXML_TEXT("0") : 0; if (_isnan(value)) return PUGIXML_TEXT("NaN"); - if (!_finite(value)) return PUGIXML_TEXT("-Infinity") + (value > 0); - if (value == 0) return PUGIXML_TEXT("0"); - return 0; + return PUGIXML_TEXT("-Infinity") + (value > 0); #elif defined(FP_NAN) && defined(FP_INFINITE) && defined(FP_ZERO) switch (fpclassify(value)) { -- cgit v1.2.3