Skip to content

Commit

Permalink
Fix clang -Wsign-conversion warning in grisu_count_digits. (fmtlib#1573)
Browse files Browse the repository at this point in the history
grisu_count_digits is only used by grisu_gen_digits, which assigns the unsigned result to a (signed) int.

Although grisu_count_digits always returns a positive integer this keeps its return type in sync with the type its result is assigned to.
  • Loading branch information
refnum authored and Thomas Bernard committed Mar 18, 2020
1 parent 372eefa commit beaa971
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/fmt/format-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ enum result {
}

// A version of count_digits optimized for grisu_gen_digits.
inline unsigned grisu_count_digits(uint32_t n) {
inline int grisu_count_digits(uint32_t n) {
if (n < 10) return 1;
if (n < 100) return 2;
if (n < 1000) return 3;
Expand Down

0 comments on commit beaa971

Please sign in to comment.