There was an error while loading. Please reload this page.
1 parent 1e86b5e commit 12fe933Copy full SHA for 12fe933
include/slimcpplib/long_io.h
@@ -84,7 +84,7 @@ inline std::basic_ostream<char_t, traits_t>& operator<<(std::basic_ostream<char_
84
base = 16;
85
86
constexpr uint_t max_digits = (bit_count_v<long_uint_t> + 2) / 3;
87
- const uint_t digit_count = static_cast<uint_t>(std::ceil((bit_count_v<long_uint_t> - nlz(value)) * std::log10(2) / std::log10(base)));
+ const uint_t digit_count = std::max<uint_t>(1, static_cast<uint_t>(std::ceil((bit_count_v<long_uint_t> - nlz(value)) * std::log10(2) / std::log10(base))));
88
const bool uppercase = (stream.flags() & std::ios::uppercase) != 0;
89
std::array<char_t, max_digits> output;
90
0 commit comments