change static_cast to to_unsigned

This commit is contained in:
Juraj 2022-02-20 20:21:10 +01:00 committed by GitHub
parent e8a6f7867f
commit c31fef4d6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -389,7 +389,7 @@ template <typename To, typename From, FMT_ENABLE_IF(sizeof(To) > sizeof(From))>
inline auto bit_cast(const From& from) -> To { inline auto bit_cast(const From& from) -> To {
constexpr auto size = static_cast<int>(sizeof(From) / sizeof(unsigned)); constexpr auto size = static_cast<int>(sizeof(From) / sizeof(unsigned));
struct data_t { struct data_t {
unsigned value[static_cast<size_t>(size)]; unsigned value[to_unsigned(size)];
} data = bit_cast<data_t>(from); } data = bit_cast<data_t>(from);
auto result = To(); auto result = To();
if (const_check(is_big_endian())) { if (const_check(is_big_endian())) {