From eeca0676df2fd8997e47ffb01d531264a5af4604 Mon Sep 17 00:00:00 2001 From: Bartosz Taudul Date: Sun, 26 Nov 2017 21:37:57 +0100 Subject: [PATCH] Even simpler lock state combining. --- server/TracyView.cpp | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) diff --git a/server/TracyView.cpp b/server/TracyView.cpp index 4bfd9f03..b0da573b 100644 --- a/server/TracyView.cpp +++ b/server/TracyView.cpp @@ -2746,10 +2746,10 @@ static inline bool AreOtherWaiting( uint64_t bitlist, uint8_t thread ) enum class LockState { - Nothing = 1 << 0, - HasLock = 1 << 1, // green - HasBlockingLock = 1 << 2, // yellow - WaitLock = 1 << 3, // red + Nothing, + HasLock, // green + HasBlockingLock, // yellow + WaitLock // red }; static Vector::iterator GetNextLockEvent( const Vector::iterator& it, const Vector::iterator& end, LockState state, LockState& nextState, uint8_t thread ) @@ -2849,22 +2849,7 @@ static Vector::iterator GetNextLockEvent( const Vector:: static LockState CombineLockState( LockState state, LockState next ) { - unsigned val = (unsigned)state | (unsigned)next; - -#ifdef _MSC_VER - DWORD ret; - _BitScanReverse( &ret, val ); - return (LockState)( 1 << ret ); -#else - unsigned ret = 1; - val >>= 1; - while( val ) - { - ret <<= 1; - val >>= 1; - } - return (LockState)ret; -#endif + return (LockState)std::max( (int)state, (int)next ); } int View::DrawLocks( uint64_t tid, bool hover, double pxns, const ImVec2& wpos, int _offset, LockHighlight& highlight )