Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove conversion compiler warnings #844

Merged
merged 4 commits into from
Aug 29, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ FMT_FUNC char *write_exponent(char *buffer, int exp) {
*buffer++ = '+';
}
if (exp >= 100) {
*buffer++ = '0' + static_cast<char>(exp / 100);
*buffer++ = static_cast<char>('0' + exp / 100);
exp %= 100;
const char *d = data::DIGITS + exp * 2;
*buffer++ = d[0];
Expand All @@ -384,7 +384,7 @@ FMT_FUNC char *write_exponent(char *buffer, int exp) {
*buffer++ = d[0];
*buffer++ = d[1];
} else {
*buffer++ = '0' + static_cast<char>(exp);
*buffer++ = static_cast<char>('0' + exp);
}
return buffer;
}
Expand Down Expand Up @@ -421,7 +421,7 @@ FMT_FUNC void grisu2_gen_digits(
FMT_ASSERT(false, "invalid number of digits");
}
if (digit != 0 || size != 0)
buffer[size++] = '0' + static_cast<char>(digit);
buffer[size++] = static_cast<char>('0' + digit);
--exp;
uint64_t remainder = (static_cast<uint64_t>(hi) << -one.e) + lo;
if (remainder <= delta) {
Expand All @@ -436,7 +436,7 @@ FMT_FUNC void grisu2_gen_digits(
delta *= 10;
char digit = static_cast<char>(lo >> -one.e);
if (digit != 0 || size != 0)
buffer[size++] = '0' + digit;
buffer[size++] = static_cast<char>('0' + digit);
lo &= one.f - 1;
--exp;
if (lo < delta) {
Expand Down Expand Up @@ -529,7 +529,7 @@ FMT_FUNC void grisu2_format(double value, char *buffer, size_t &size, char type,
size_t unsigned_precision = precision >= 0 ? precision : 6;
if (size > unsigned_precision) {
// TODO: round instead of truncating
dec_exp += size - unsigned_precision;
dec_exp += static_cast<int>(size - unsigned_precision);
size = unsigned_precision;
}
grisu2_prettify(buffer, size, dec_exp, type, unsigned_precision,
Expand Down