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:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user