mirror of
https://github.com/fmtlib/fmt.git
synced 2025-07-31 19:24:48 +02:00
Take integer promotion into account.
This commit is contained in:
@@ -300,7 +300,7 @@ template <typename T, typename U>
|
|||||||
std::string sprintf_int(std::string format, U value) {
|
std::string sprintf_int(std::string format, U value) {
|
||||||
char buffer[BUFFER_SIZE];
|
char buffer[BUFFER_SIZE];
|
||||||
char type = format[format.size() - 1];
|
char type = format[format.size() - 1];
|
||||||
if (sizeof(T) < sizeof(U)) {
|
if (sizeof(T) < sizeof(int)) {
|
||||||
if (type == 'd' || type == 'i') {
|
if (type == 'd' || type == 'i') {
|
||||||
typedef typename MakeSigned<T>::Type Signed;
|
typedef typename MakeSigned<T>::Type Signed;
|
||||||
safe_sprintf(buffer, format.c_str(), static_cast<Signed>(value));
|
safe_sprintf(buffer, format.c_str(), static_cast<Signed>(value));
|
||||||
|
Reference in New Issue
Block a user