diff --git a/source/simple/support/misc.hpp b/source/simple/support/misc.hpp index d8d697ad72e0aefbee6a8f27250dee1d479d85a1..85d6cfeafe807a419b461e9c96a04e68cfc7eb6c 100644 --- a/source/simple/support/misc.hpp +++ b/source/simple/support/misc.hpp @@ -6,6 +6,7 @@ #include <stdexcept> #include <string> #include <optional> +#include <cinttypes> #include "range.hpp" @@ -32,7 +33,7 @@ namespace simple::support return std::strtoull(str, end, 0); 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(); if(!limit.intersects(n)) { @@ -43,7 +44,7 @@ namespace simple::support } 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) { errno = ERANGE;