Fix another warning
This commit is contained in:
parent
40696e8d02
commit
06372b772f
@ -47,6 +47,10 @@ namespace microfmt {
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
template<typename U, typename V> U to(V v) {
|
||||||
|
return static_cast<U>(v); // A way to cast to U without "warning: useless cast to type"
|
||||||
|
}
|
||||||
|
|
||||||
enum class alignment { left, right };
|
enum class alignment { left, right };
|
||||||
|
|
||||||
struct format_options {
|
struct format_options {
|
||||||
@ -84,7 +88,7 @@ namespace microfmt {
|
|||||||
// log_2(x) == 63 - clz(x)
|
// log_2(x) == 63 - clz(x)
|
||||||
// 1 + (63 - clz(value)) / (63 - clz(1 << shift))
|
// 1 + (63 - clz(value)) / (63 - clz(1 << shift))
|
||||||
// 63 - clz(1 << shift) is the same as shift
|
// 63 - clz(1 << shift) is the same as shift
|
||||||
auto n_digits = static_cast<std::size_t>(1 + (63 - clz(value)) / shift);
|
auto n_digits = to<std::size_t>(1 + (63 - clz(value)) / shift);
|
||||||
std::string number;
|
std::string number;
|
||||||
number.resize(n_digits);
|
number.resize(n_digits);
|
||||||
std::size_t i = n_digits - 1;
|
std::size_t i = n_digits - 1;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user