From 0067ea8f9eeb0f7c3987a27e739032957e196456 Mon Sep 17 00:00:00 2001 From: Ferenc Nasztanovics Date: Wed, 13 Mar 2019 23:42:46 +0100 Subject: [PATCH] Change macros to numeric_limits #1483 --- include/nlohmann/detail/conversions/to_chars.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/conversions/to_chars.hpp b/include/nlohmann/detail/conversions/to_chars.hpp index 7757c95e..b6cb22ae 100644 --- a/include/nlohmann/detail/conversions/to_chars.hpp +++ b/include/nlohmann/detail/conversions/to_chars.hpp @@ -751,7 +751,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent, // = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e // = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e // - assert(p2 <= UINT64_MAX / 10); + assert(p2 <= std::numeric_limits::max() / 10); p2 *= 10; const uint64_t d = p2 >> -one.e; // d = (10 * p2) div 2^-e const uint64_t r = p2 & (one.f - 1); // r = (10 * p2) mod 2^-e diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index a77bf974..50ed3068 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -10579,7 +10579,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent, // = buffer * 10^-m + 10^-m * (1/10 * (10 * p2) ) * 2^e // = buffer * 10^-m + 10^-m * (1/10 * ((10*p2 div 2^-e) * 2^-e + (10*p2 mod 2^-e)) * 2^e // - assert(p2 <= UINT64_MAX / 10); + assert(p2 <= std::numeric_limits::max() / 10); p2 *= 10; const uint64_t d = p2 >> -one.e; // d = (10 * p2) div 2^-e const uint64_t r = p2 & (one.f - 1); // r = (10 * p2) mod 2^-e