Skip to content

Commit

Permalink
Fix clang -Wsign-conversion warning in grisu_count_digits. (#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 Mar 4, 2020
1 parent 1e84931 commit 68742e1
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 @@ -756,7 +756,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 68742e1

Please sign in to comment.