summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h')
-rw-r--r--src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h b/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
index b32e42253f..6ea779ab8f 100644
--- a/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
+++ b/src/3rdparty/angle/src/compiler/preprocessor/numeric_lex.h
@@ -9,15 +9,15 @@
#ifndef COMPILER_PREPROCESSOR_NUMERICLEX_H_
#define COMPILER_PREPROCESSOR_NUMERICLEX_H_
+#include <cmath>
#include <sstream>
-namespace pp {
+namespace pp
+{
inline std::ios::fmtflags numeric_base_int(const std::string &str)
{
- if ((str.size() >= 2) &&
- (str[0] == '0') &&
- (str[1] == 'x' || str[1] == 'X'))
+ if ((str.size() >= 2) && (str[0] == '0') && (str[1] == 'x' || str[1] == 'X'))
{
return std::ios::hex;
}
@@ -33,7 +33,7 @@ inline std::ios::fmtflags numeric_base_int(const std::string &str)
// of the correct form. They can only fail if the parsed value is too big,
// in which case false is returned.
-template<typename IntType>
+template <typename IntType>
bool numeric_lex_int(const std::string &str, IntType *value)
{
std::istringstream stream(str);
@@ -45,7 +45,7 @@ bool numeric_lex_int(const std::string &str, IntType *value)
return !stream.fail();
}
-template<typename FloatType>
+template <typename FloatType>
bool numeric_lex_float(const std::string &str, FloatType *value)
{
// On 64-bit Intel Android, istringstream is broken. Until this is fixed in
@@ -63,10 +63,10 @@ bool numeric_lex_float(const std::string &str, FloatType *value)
stream.imbue(std::locale::classic());
stream >> (*value);
- return !stream.fail();
+ return !stream.fail() && std::isfinite(*value);
#endif
}
-} // namespace pp.
+} // namespace pp.
-#endif // COMPILER_PREPROCESSOR_NUMERICLEX_H_
+#endif // COMPILER_PREPROCESSOR_NUMERICLEX_H_