From 6718a49486b307ad938b707549ac1dfb78504300 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Wed, 30 Mar 2022 04:49:29 -0700 Subject: Replace a few asserts with actual checks or ASSUME() --- al/source.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'al/source.cpp') diff --git a/al/source.cpp b/al/source.cpp index ea3a4de7..dee4af2a 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -266,7 +266,7 @@ double GetSourceSecOffset(ALsource *Source, ALCcontext *context, nanoseconds *cl BufferFmt = BufferList->mBuffer; ++BufferList; } - assert(BufferFmt != nullptr); + ASSUME(BufferFmt != nullptr); return static_cast(readPos) / double{MixerFracOne} / BufferFmt->mSampleRate; } @@ -315,7 +315,7 @@ double GetSourceOffset(ALsource *Source, ALenum name, ALCcontext *context) BufferFmt = BufferList->mBuffer; ++BufferList; } - assert(BufferFmt != nullptr); + ASSUME(BufferFmt != nullptr); double offset{}; switch(name) @@ -375,7 +375,7 @@ double GetSourceLength(const ALsource *source, ALenum name) if(length == 0) return 0.0; - assert(BufferFmt != nullptr); + ASSUME(BufferFmt != nullptr); switch(name) { case AL_SEC_LENGTH_SOFT: @@ -585,7 +585,7 @@ bool SetVoiceOffset(Voice *oldvoice, const VoicePos &vpos, ALsource *source, ALC } ++vidx; } - if UNLIKELY(!newvoice) + if(unlikely(!newvoice)) { auto &allvoices = *context->mVoices.load(std::memory_order_relaxed); if(allvoices.size() == voicelist.size()) @@ -605,7 +605,7 @@ bool SetVoiceOffset(Voice *oldvoice, const VoicePos &vpos, ALsource *source, ALC } ++vidx; } - assert(newvoice != nullptr); + ASSUME(newvoice != nullptr); } /* Initialize the new voice and set its starting offset. @@ -3169,7 +3169,7 @@ START_API_FUNC break; } } - assert(voice != nullptr); + ASSUME(voice != nullptr); voice->mPosition.store(0u, std::memory_order_relaxed); voice->mPositionFrac.store(0, std::memory_order_relaxed); -- cgit v1.2.3