diff options
author | Chris Robinson <[email protected]> | 2018-12-02 15:29:26 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2018-12-02 15:29:26 -0800 |
commit | 45b65366bb2ba6c11756e2509589e310b9f0df88 (patch) | |
tree | 5525a1c5f3bdc9d850e75036415c8e562489d406 /OpenAL32/alSource.cpp | |
parent | 60254488e9faa2934e9d261328a3c0359056bdd0 (diff) |
Improve some checks for compiler analysis
Diffstat (limited to 'OpenAL32/alSource.cpp')
-rw-r--r-- | OpenAL32/alSource.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/OpenAL32/alSource.cpp b/OpenAL32/alSource.cpp index 4cc3526b..463d2438 100644 --- a/OpenAL32/alSource.cpp +++ b/OpenAL32/alSource.cpp @@ -2977,11 +2977,11 @@ AL_API ALvoid AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALu std::lock_guard<std::mutex> _{context->SourceLock}; ALsource *source{LookupSource(context.get(),src)}; - if(!source) + if(UNLIKELY(!source)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src); /* Can't queue on a Static Source */ - if(source->SourceType == AL_STATIC) + if(UNLIKELY(source->SourceType == AL_STATIC)) SETERR_RETURN(context.get(), AL_INVALID_OPERATION,, "Queueing onto static source %u", src); /* Check for a valid Buffer, for its frequency and format */ @@ -3094,11 +3094,11 @@ AL_API void AL_APIENTRY alSourceQueueBufferLayersSOFT(ALuint src, ALsizei nb, co std::lock_guard<std::mutex> _{context->SourceLock}; ALsource *source{LookupSource(context.get(),src)}; - if(!source) + if(UNLIKELY(!source)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src); /* Can't queue on a Static Source */ - if(source->SourceType == AL_STATIC) + if(UNLIKELY(source->SourceType == AL_STATIC)) SETERR_RETURN(context.get(), AL_INVALID_OPERATION,, "Queueing onto static source %u", src); /* Check for a valid Buffer, for its frequency and format */ @@ -3202,12 +3202,12 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint std::lock_guard<std::mutex> _{context->SourceLock}; ALsource *source{LookupSource(context.get(),src)}; - if(!source) + if(UNLIKELY(!source)) SETERR_RETURN(context.get(), AL_INVALID_NAME,, "Invalid source ID %u", src); - if(source->Looping) + if(UNLIKELY(source->Looping)) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing from looping source %u", src); - if(source->SourceType != AL_STREAMING) + if(UNLIKELY(source->SourceType != AL_STREAMING)) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing from a non-streaming source %u", src); @@ -3219,7 +3219,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint Current = voice->current_buffer.load(std::memory_order_relaxed); else if(source->state == AL_INITIAL) Current = BufferList; - if(BufferList == Current) + if(UNLIKELY(BufferList == Current)) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing pending buffers"); ALsizei i{BufferList->num_buffers}; @@ -3229,7 +3229,7 @@ AL_API ALvoid AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint * trying to unqueue pending buffers. */ ALbufferlistitem *next{BufferList->next.load(std::memory_order_relaxed)}; - if(!next || next == Current) + if(UNLIKELY(!next) || UNLIKELY(next == Current)) SETERR_RETURN(context.get(), AL_INVALID_VALUE,, "Unqueueing pending buffers"); BufferList = next; |