summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/translator/util.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/translator/util.cpp')
-rw-r--r--src/3rdparty/angle/src/compiler/translator/util.cpp28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/3rdparty/angle/src/compiler/translator/util.cpp b/src/3rdparty/angle/src/compiler/translator/util.cpp
new file mode 100644
index 0000000000..077bdcc48b
--- /dev/null
+++ b/src/3rdparty/angle/src/compiler/translator/util.cpp
@@ -0,0 +1,28 @@
+//
+// Copyright (c) 2010 The ANGLE Project Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+//
+
+#include "compiler/translator/util.h"
+
+#include <limits>
+
+#include "compiler/preprocessor/numeric_lex.h"
+
+bool atof_clamp(const char *str, float *value)
+{
+ bool success = pp::numeric_lex_float(str, value);
+ if (!success)
+ *value = std::numeric_limits<float>::max();
+ return success;
+}
+
+bool atoi_clamp(const char *str, int *value)
+{
+ bool success = pp::numeric_lex_int(str, value);
+ if (!success)
+ *value = std::numeric_limits<int>::max();
+ return success;
+}
+