Changeset - r27172:6984e50a4df8
[Not reviewed]
master
0 2 0
Rubidium - 17 months ago 2023-04-19 19:44:56
rubidium@openttd.org
Codechange: use fmt::format for FormatHexNumber
2 files changed with 2 insertions and 16 deletions:
0 comments (0 inline, 0 general)
src/stdafx.h
Show inline comments
 
@@ -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
src/strings.cpp
Show inline comments
 
@@ -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 *
 

	
 
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);
 
}
 

	
 
/**
0 comments (0 inline, 0 general)