Skip to content
Snippets Groups Projects
Commit 54c70c33 authored by namark's avatar namark
Browse files

These existed!

parent 3536b19a
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#include <stdexcept> #include <stdexcept>
#include <string> #include <string>
#include <optional> #include <optional>
#include <cinttypes>
#include "range.hpp" #include "range.hpp"
...@@ -32,7 +33,7 @@ namespace simple::support ...@@ -32,7 +33,7 @@ namespace simple::support
return std::strtoull(str, end, 0); return std::strtoull(str, end, 0);
else if constexpr (std::is_signed_v<N>) else if constexpr (std::is_signed_v<N>)
{ {
auto n = std::strtol(str, end, 0); auto n = std::strtoimax(str, end, 0);
constexpr auto limit = range<N>::limit(); constexpr auto limit = range<N>::limit();
if(!limit.intersects(n)) if(!limit.intersects(n))
{ {
...@@ -43,7 +44,7 @@ namespace simple::support ...@@ -43,7 +44,7 @@ namespace simple::support
} }
else if constexpr (std::is_unsigned_v<N>) else if constexpr (std::is_unsigned_v<N>)
{ {
auto n = std::strtoul(str, end, 0); auto n = std::strtoumax(str, end, 0);
if(std::numeric_limits<N>::max() < n) if(std::numeric_limits<N>::max() < n)
{ {
errno = ERANGE; errno = ERANGE;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment