Update format.h

To prevent the following compiler message:
[...]/include/fmt/format.h:392:20: warning: conversion to 'long unsigned int' from 'int' may change the sign of the result [-Wsign-conversion]
  392 |     unsigned value[size];
      |                    ^~~~
This commit is contained in:
Juraj 2022-02-19 11:10:45 +01:00 committed by GitHub
parent 7b96420961
commit bc65d58c1d
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[size]; unsigned value[static_cast<size_t>(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())) {