diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-05-31 07:56:13 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2010-05-31 07:56:13 +0000 |
commit | f1bfe4cc64218d015a8415b37b30127327df8b39 (patch) | |
tree | 9ed0fb1994049f66d69aa37356d3f56132d99de5 /src | |
parent | 51bb70cdcf772093c97655b65ab1691c6025e0b5 (diff) |
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
Diffstat (limited to 'src')
-rw-r--r-- | src/pugixpath.cpp | 27 |
1 files changed, 3 insertions, 24 deletions
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))
{
|