mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 12:14:26 +00:00
Fix clang -Wsign-conversion warning in grisu_count_digits. (#1573)
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.
This commit is contained in:
parent
1e8493196e
commit
68742e1d87
@ -756,7 +756,7 @@ enum result {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// A version of count_digits optimized for grisu_gen_digits.
|
// 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 < 10) return 1;
|
||||||
if (n < 100) return 2;
|
if (n < 100) return 2;
|
||||||
if (n < 1000) return 3;
|
if (n < 1000) return 3;
|
||||||
|
Loading…
Reference in New Issue
Block a user