Remove conversion compiler warning
When compiling with g++8, I get the following two errors:
include/fmt/format-inl.h:400:29: error: conversion from ‘int’ to ‘char’ may change value [-Werror=conversion]
buffer[size++] = zero + static_cast<char>(digit);
~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~
include/fmt/format-inl.h:416:28: error: conversion from ‘int’ to ‘char’ may change value [-Werror=conversion]
buffer[size++] = '0' + digit;
~~~~^~~~~~~
With this change, the errors are gone.
This commit is contained in:
parent
f0d0a1ebd7
commit
22cfa65a3f
@ -395,7 +395,7 @@ FMT_FUNC void grisu2_gen_digits(
|
|||||||
FMT_ASSERT(false, "invalid number of digits");
|
FMT_ASSERT(false, "invalid number of digits");
|
||||||
}
|
}
|
||||||
if (digit != 0 || size != 0)
|
if (digit != 0 || size != 0)
|
||||||
buffer[size++] = '0' + static_cast<char>(digit);
|
buffer[size++] = static_cast<char>('0' + static_cast<char>(digit));
|
||||||
--kappa;
|
--kappa;
|
||||||
uint64_t remainder = (static_cast<uint64_t>(hi) << -one.e) + lo;
|
uint64_t remainder = (static_cast<uint64_t>(hi) << -one.e) + lo;
|
||||||
if (remainder <= delta) {
|
if (remainder <= delta) {
|
||||||
@ -410,7 +410,7 @@ FMT_FUNC void grisu2_gen_digits(
|
|||||||
delta *= 10;
|
delta *= 10;
|
||||||
char digit = static_cast<char>(lo >> -one.e);
|
char digit = static_cast<char>(lo >> -one.e);
|
||||||
if (digit != 0 || size != 0)
|
if (digit != 0 || size != 0)
|
||||||
buffer[size++] = '0' + digit;
|
buffer[size++] = static_cast<char>('0' + digit);
|
||||||
lo &= one.f - 1;
|
lo &= one.f - 1;
|
||||||
--kappa;
|
--kappa;
|
||||||
if (lo < delta) {
|
if (lo < delta) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user