Commit 1f25659c authored by Branislav Katreniak's avatar Branislav Katreniak

kj/string.cpp: remove #include <limits>

parent 9de93601
...@@ -25,7 +25,6 @@ ...@@ -25,7 +25,6 @@
#include <float.h> #include <float.h>
#include <errno.h> #include <errno.h>
#include <stdlib.h> #include <stdlib.h>
#include <limits>
namespace kj { namespace kj {
...@@ -61,12 +60,12 @@ unsigned long long parseUnsigned(const StringPtr& s, unsigned long long max) { ...@@ -61,12 +60,12 @@ unsigned long long parseUnsigned(const StringPtr& s, unsigned long long max) {
template <typename T> template <typename T>
T parseInteger(const StringPtr& s) { T parseInteger(const StringPtr& s) {
if (std::numeric_limits<T>::is_signed) { if (static_cast<T>(minValue) < 0) {
auto min = (long long) std::numeric_limits<T>::min(); long long min = static_cast<T>(minValue);
auto max = (long long) std::numeric_limits<T>::max(); long long max = static_cast<T>(maxValue);
return static_cast<T>(parseSigned(s, min, max)); return static_cast<T>(parseSigned(s, min, max));
} else { } else {
auto max = (unsigned long long) std::numeric_limits<T>::max(); long long max = static_cast<T>(maxValue);
return static_cast<T>(parseUnsigned(s, max)); return static_cast<T>(parseUnsigned(s, max));
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment