From 45f9ece0b1f7d0c1bef9d24f90e2850abbe4d428 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Legat?= Date: Sun, 18 May 2025 09:30:38 +0200 Subject: [PATCH] Apply review comment --- server/TracyPrint.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/server/TracyPrint.cpp b/server/TracyPrint.cpp index d77c1375..9111ddb0 100644 --- a/server/TracyPrint.cpp +++ b/server/TracyPrint.cpp @@ -71,7 +71,7 @@ static inline void PrintSmallInt( char*& buf, uint64_t v ) static inline void PrintSmallInt0( char*& buf, uint64_t v ) { - assert( v < uint64_t(1000ll) ); + assert( v < 1000 ); if( v >= 100 ) { memcpy( buf, IntTable100 + v/10*2, 2 ); @@ -157,13 +157,13 @@ static inline void PrintSecondsFrac( char*& buf, uint64_t v ) uint64_t _int64_abs( int64_t x ) { - if( x == std::numeric_limits::min() ) + if( x < 0 ) { - return -(x + 1) + 1; - } - else if( x < 0 ) - { - return -x; + // `-x` does not work if `x` is `std::numeric_limits::min()`, + // see https://github.com/wolfpld/tracy/pull/1040 + // This works though: + // https://graphics.stanford.edu/~seander/bithacks.html#IntegerAbs + return -(uint64_t)x; } else {