mirror of
https://github.com/wolfpld/tracy
synced 2025-04-29 20:33:52 +00:00
Leverage std::to_chars.
This commit is contained in:
parent
36fb1f96e2
commit
3050f19e0b
@ -1,7 +1,11 @@
|
|||||||
#ifndef __TRACYPRINT_HPP__
|
#ifndef __TRACYPRINT_HPP__
|
||||||
#define __TRACYPRINT_HPP__
|
#define __TRACYPRINT_HPP__
|
||||||
|
|
||||||
#include <stdio.h>
|
#if ( defined _MSC_VER && _MSVC_LANG >= 201703L ) || __cplusplus >= 201703L
|
||||||
|
# include <charconv>
|
||||||
|
#else
|
||||||
|
# include <stdio.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace tracy
|
namespace tracy
|
||||||
{
|
{
|
||||||
@ -9,7 +13,11 @@ namespace tracy
|
|||||||
template<typename T>
|
template<typename T>
|
||||||
static inline char* PrintFloat( char* begin, char* end, T value, int precision )
|
static inline char* PrintFloat( char* begin, char* end, T value, int precision )
|
||||||
{
|
{
|
||||||
|
#if ( defined _MSC_VER && _MSVC_LANG >= 201703L ) || __cplusplus >= 201703L
|
||||||
|
return std::to_chars( begin, end, value, std::chars_format::fixed, precision ).ptr;
|
||||||
|
#else
|
||||||
return begin + sprintf( begin, "%.*f", precision, value );
|
return begin + sprintf( begin, "%.*f", precision, value );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* TimeToString( int64_t ns );
|
const char* TimeToString( int64_t ns );
|
||||||
|
Loading…
x
Reference in New Issue
Block a user