1
0
mirror of https://github.com/wolfpld/tracy.git synced 2025-03-20 07:40:02 +08:00

Use std::to_chars() in RealToString().

This commit is contained in:
Bartosz Taudul
2020-01-31 01:44:38 +01:00
parent f017b27ae2
commit 1475635382
2 changed files with 15 additions and 5 deletions
+10
View File
@@ -20,6 +20,16 @@ static inline char* PrintFloat( char* begin, char* end, T value, int precision )
#endif
}
template<typename T>
static inline char* PrintFloat( char* begin, char* end, T value )
{
#if ( defined _MSC_VER && _MSVC_LANG >= 201703L ) || __cplusplus >= 201703L
return std::to_chars( begin, end, value, std::chars_format::fixed ).ptr;
#else
return begin + sprintf( begin, "%f", value );
#endif
}
const char* TimeToString( int64_t ns );
const char* RealToString( double val );
const char* MemSizeToString( int64_t val );