Comment
This commit is contained in:
parent
c57d7a506f
commit
32344d9b14
@ -230,7 +230,7 @@ class PrecisionHandler :
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Converts an integer argument to type T.
|
// Converts an integer argument to an integral type T for printf.
|
||||||
template <typename T>
|
template <typename T>
|
||||||
class ArgConverter : public fmt::internal::ArgVisitor<ArgConverter<T>, void> {
|
class ArgConverter : public fmt::internal::ArgVisitor<ArgConverter<T>, void> {
|
||||||
private:
|
private:
|
||||||
@ -246,6 +246,7 @@ class ArgConverter : public fmt::internal::ArgVisitor<ArgConverter<T>, void> {
|
|||||||
bool is_signed = type_ == 'd' || type_ == 'i';
|
bool is_signed = type_ == 'd' || type_ == 'i';
|
||||||
using fmt::internal::Arg;
|
using fmt::internal::Arg;
|
||||||
if (sizeof(T) <= sizeof(int)) {
|
if (sizeof(T) <= sizeof(int)) {
|
||||||
|
// Extra casts are used to silence warnings.
|
||||||
if (is_signed) {
|
if (is_signed) {
|
||||||
arg_.type = Arg::INT;
|
arg_.type = Arg::INT;
|
||||||
arg_.int_value = static_cast<int>(static_cast<T>(value));
|
arg_.int_value = static_cast<int>(static_cast<T>(value));
|
||||||
@ -268,7 +269,7 @@ class ArgConverter : public fmt::internal::ArgVisitor<ArgConverter<T>, void> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Converts an integer argument to char.
|
// Converts an integer argument to char for printf.
|
||||||
class CharConverter : public fmt::internal::ArgVisitor<CharConverter, void> {
|
class CharConverter : public fmt::internal::ArgVisitor<CharConverter, void> {
|
||||||
private:
|
private:
|
||||||
fmt::internal::Arg &arg_;
|
fmt::internal::Arg &arg_;
|
||||||
|
Loading…
Reference in New Issue
Block a user