From df6d61dd40b602af55f903564358b083bb8b37e4 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Mon, 5 Dec 2022 14:51:03 -0800 Subject: Use standard likely/unlikely attributes when available --- common/intrusive_ptr.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'common/intrusive_ptr.h') diff --git a/common/intrusive_ptr.h b/common/intrusive_ptr.h index 9e206a6b..ba932b95 100644 --- a/common/intrusive_ptr.h +++ b/common/intrusive_ptr.h @@ -18,7 +18,7 @@ public: unsigned int release() noexcept { auto ref = DecrementRef(mRef); - if UNLIKELY(ref == 0) + if(ref == 0) [[alunlikely]] delete static_cast(this); return ref; } @@ -71,7 +71,7 @@ public: } intrusive_ptr& operator=(intrusive_ptr&& rhs) noexcept { - if(likely(&rhs != this)) + if(&rhs != this) [[allikely]] { if(mPtr) mPtr->release(); mPtr = std::exchange(rhs.mPtr, nullptr); -- cgit v1.2.3