mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-01-31 11:23:21 +00:00
Codechange: use fmt::format for FormatHexNumber
This commit is contained in:
parent
630d3bc053
commit
75cd790ab9
15
src/stdafx.h
15
src/stdafx.h
@ -298,21 +298,6 @@
|
||||
#endif
|
||||
#define PACK(type_dec) PACK_N(type_dec, 1)
|
||||
|
||||
/* MSVCRT of course has to have a different syntax for long long *sigh* */
|
||||
#if defined(_MSC_VER)
|
||||
# define OTTD_PRINTF64 "%I64d"
|
||||
# define OTTD_PRINTF64U "%I64u"
|
||||
# define OTTD_PRINTFHEX64 "%I64x"
|
||||
#elif defined(__MINGW32__)
|
||||
# define OTTD_PRINTF64 "%I64d"
|
||||
# define OTTD_PRINTF64U "%I64llu"
|
||||
# define OTTD_PRINTFHEX64 "%I64x"
|
||||
#else
|
||||
# define OTTD_PRINTF64 "%lld"
|
||||
# define OTTD_PRINTF64U "%llu"
|
||||
# define OTTD_PRINTFHEX64 "%llx"
|
||||
#endif
|
||||
|
||||
/*
|
||||
* When making a (pure) debug build, the compiler will by default disable
|
||||
* inlining of functions. This has a detremental effect on the performance of
|
||||
|
@ -39,6 +39,7 @@
|
||||
#include "newgrf_engine.h"
|
||||
#include "core/backup_type.hpp"
|
||||
#include <stack>
|
||||
#include <charconv>
|
||||
|
||||
#include "table/strings.h"
|
||||
#include "table/control_codes.h"
|
||||
@ -382,7 +383,7 @@ static char *FormatZerofillNumber(char *buff, int64 number, int64 count, const c
|
||||
|
||||
static char *FormatHexNumber(char *buff, uint64 number, const char *last)
|
||||
{
|
||||
return buff + seprintf(buff, last, "0x" OTTD_PRINTFHEX64, number);
|
||||
return strecpy(buff, fmt::format("0x{:X}", number).c_str(), last);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user