diff options
34 files changed, 494 insertions, 502 deletions
diff --git a/al/auxeffectslot.cpp b/al/auxeffectslot.cpp index 0eca5cb7..e5d75440 100644 --- a/al/auxeffectslot.cpp +++ b/al/auxeffectslot.cpp @@ -90,10 +90,10 @@ inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) noexcept const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= context->mEffectSlotList.size()) [[alunlikely]] + if(lidx >= context->mEffectSlotList.size()) [[unlikely]] return nullptr; EffectSlotSubList &sublist{context->mEffectSlotList[lidx]}; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.EffectSlots + slidx; } @@ -103,10 +103,10 @@ inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) noexcept const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= device->EffectList.size()) [[alunlikely]] + if(lidx >= device->EffectList.size()) [[unlikely]] return nullptr; EffectSubList &sublist = device->EffectList[lidx]; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.Effects + slidx; } @@ -116,10 +116,10 @@ inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) noexcept const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= device->BufferList.size()) [[alunlikely]] + if(lidx >= device->BufferList.size()) [[unlikely]] return nullptr; BufferSubList &sublist = device->BufferList[lidx]; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.Buffers + slidx; } @@ -159,7 +159,7 @@ void AddActiveEffectSlots(const al::span<ALeffectslot*> auxslots, ALCcontext *co /* Reallocate newarray if the new size ended up smaller from duplicate * removal. */ - if(newcount < newarray->size()) [[alunlikely]] + if(newcount < newarray->size()) [[unlikely]] { curarray = newarray; newarray = EffectSlot::CreatePtrArray(newcount); @@ -197,7 +197,7 @@ void RemoveActiveEffectSlots(const al::span<ALeffectslot*> auxslots, ALCcontext /* Reallocate with the new size. */ auto newsize = static_cast<size_t>(std::distance(newarray->begin(), new_end)); - if(newsize != newarray->size()) [[allikely]] + if(newsize != newarray->size()) [[likely]] { curarray = newarray; newarray = EffectSlot::CreatePtrArray(newsize); @@ -251,7 +251,7 @@ bool EnsureEffectSlots(ALCcontext *context, size_t needed) while(needed > count) { - if(context->mEffectSlotList.size() >= 1<<25) [[alunlikely]] + if(context->mEffectSlotList.size() >= 1<<25) [[unlikely]] return false; context->mEffectSlotList.emplace_back(); @@ -259,7 +259,7 @@ bool EnsureEffectSlots(ALCcontext *context, size_t needed) sublist->FreeMask = ~0_u64; sublist->EffectSlots = static_cast<ALeffectslot*>( al_calloc(alignof(ALeffectslot), sizeof(ALeffectslot)*64)); - if(!sublist->EffectSlots) [[alunlikely]] + if(!sublist->EffectSlots) [[unlikely]] { context->mEffectSlotList.pop_back(); return false; @@ -320,11 +320,11 @@ AL_API void AL_APIENTRY alGenAuxiliaryEffectSlots(ALsizei n, ALuint *effectslots START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Generating %d effect slots", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALCdevice *device{context->mALDevice.get()}; @@ -364,22 +364,22 @@ AL_API void AL_APIENTRY alDeleteAuxiliaryEffectSlots(ALsizei n, const ALuint *ef START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Deleting %d effect slots", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; if(n == 1) { ALeffectslot *slot{LookupEffectSlot(context.get(), effectslots[0])}; - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslots[0]); return; } - if(ReadRef(slot->ref) != 0) [[alunlikely]] + if(ReadRef(slot->ref) != 0) [[unlikely]] { context->setError(AL_INVALID_OPERATION, "Deleting in-use effect slot %u", effectslots[0]); @@ -394,12 +394,12 @@ START_API_FUNC for(size_t i{0};i < slots.size();++i) { ALeffectslot *slot{LookupEffectSlot(context.get(), effectslots[i])}; - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", effectslots[i]); return; } - if(ReadRef(slot->ref) != 0) [[alunlikely]] + if(ReadRef(slot->ref) != 0) [[unlikely]] { context->setError(AL_INVALID_OPERATION, "Deleting in-use effect slot %u", effectslots[i]); @@ -428,7 +428,7 @@ AL_API ALboolean AL_APIENTRY alIsAuxiliaryEffectSlot(ALuint effectslot) START_API_FUNC { ContextRef context{GetContextRef()}; - if(context) [[allikely]] + if(context) [[likely]] { std::lock_guard<std::mutex> _{context->mEffectSlotLock}; if(LookupEffectSlot(context.get(), effectslot) != nullptr) @@ -443,11 +443,11 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSlotPlaySOFT(ALuint slotid) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot{LookupEffectSlot(context.get(), slotid)}; - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", slotid); return; @@ -467,18 +467,18 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSlotPlayvSOFT(ALsizei n, const ALuint * START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Playing %d effect slots", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; auto slots = al::vector<ALeffectslot*>(static_cast<ALuint>(n)); std::lock_guard<std::mutex> _{context->mEffectSlotLock}; for(size_t i{0};i < slots.size();++i) { ALeffectslot *slot{LookupEffectSlot(context.get(), slotids[i])}; - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", slotids[i]); return; @@ -502,11 +502,11 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSlotStopSOFT(ALuint slotid) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot{LookupEffectSlot(context.get(), slotid)}; - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", slotid); return; @@ -521,18 +521,18 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSlotStopvSOFT(ALsizei n, const ALuint * START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Stopping %d effect slots", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; auto slots = al::vector<ALeffectslot*>(static_cast<ALuint>(n)); std::lock_guard<std::mutex> _{context->mEffectSlotLock}; for(size_t i{0};i < slots.size();++i) { ALeffectslot *slot{LookupEffectSlot(context.get(), slotids[i])}; - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid effect slot ID %u", slotids[i]); return; @@ -552,12 +552,12 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSloti(ALuint effectslot, ALenum param, START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); ALeffectslot *target{}; @@ -580,12 +580,12 @@ START_API_FUNC err = slot->initEffect(AL_EFFECT_NULL, EffectProps{}, context.get()); } } - if(err != AL_NO_ERROR) [[alunlikely]] + if(err != AL_NO_ERROR) [[unlikely]] { context->setError(err, "Effect initialization failed"); return; } - if(slot->mState == SlotState::Initial) [[alunlikely]] + if(slot->mState == SlotState::Initial) [[unlikely]] { slot->mPropsDirty = false; slot->updateProps(context.get()); @@ -600,7 +600,7 @@ START_API_FUNC if(!(value == AL_TRUE || value == AL_FALSE)) SETERR_RETURN(context, AL_INVALID_VALUE,, "Effect slot auxiliary send auto out of range"); - if(slot->AuxSendAuto == !!value) [[alunlikely]] + if(slot->AuxSendAuto == !!value) [[unlikely]] return; slot->AuxSendAuto = !!value; break; @@ -609,7 +609,7 @@ START_API_FUNC target = LookupEffectSlot(context.get(), static_cast<ALuint>(value)); if(value && !target) SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid effect slot target ID"); - if(slot->Target == target) [[alunlikely]] + if(slot->Target == target) [[unlikely]] return; if(target) { @@ -647,10 +647,10 @@ START_API_FUNC if(ALbuffer *buffer{slot->Buffer}) { - if(buffer->id == static_cast<ALuint>(value)) [[alunlikely]] + if(buffer->id == static_cast<ALuint>(value)) [[unlikely]] return; } - else if(value == 0) [[alunlikely]] + else if(value == 0) [[unlikely]] return; { @@ -703,11 +703,11 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); switch(param) @@ -723,12 +723,12 @@ AL_API void AL_APIENTRY alAuxiliaryEffectSlotf(ALuint effectslot, ALenum param, START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); switch(param) @@ -736,7 +736,7 @@ START_API_FUNC case AL_EFFECTSLOT_GAIN: if(!(value >= 0.0f && value <= 1.0f)) SETERR_RETURN(context, AL_INVALID_VALUE,, "Effect slot gain out of range"); - if(slot->Gain == value) [[alunlikely]] + if(slot->Gain == value) [[unlikely]] return; slot->Gain = value; break; @@ -760,11 +760,11 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); switch(param) @@ -781,11 +781,11 @@ AL_API void AL_APIENTRY alGetAuxiliaryEffectSloti(ALuint effectslot, ALenum para START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); switch(param) @@ -833,11 +833,11 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); switch(param) @@ -853,11 +853,11 @@ AL_API void AL_APIENTRY alGetAuxiliaryEffectSlotf(ALuint effectslot, ALenum para START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); switch(param) @@ -883,11 +883,11 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mEffectSlotLock}; ALeffectslot *slot = LookupEffectSlot(context.get(), effectslot); - if(!slot) [[alunlikely]] + if(!slot) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid effect slot ID %u", effectslot); switch(param) diff --git a/al/buffer.cpp b/al/buffer.cpp index 01c0e2b4..6deb3788 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -411,14 +411,14 @@ bool EnsureBuffers(ALCdevice *device, size_t needed) while(needed > count) { - if(device->BufferList.size() >= 1<<25) [[alunlikely]] + if(device->BufferList.size() >= 1<<25) [[unlikely]] return false; device->BufferList.emplace_back(); auto sublist = device->BufferList.end() - 1; sublist->FreeMask = ~0_u64; sublist->Buffers = static_cast<ALbuffer*>(al_calloc(alignof(ALbuffer), sizeof(ALbuffer)*64)); - if(!sublist->Buffers) [[alunlikely]] + if(!sublist->Buffers) [[unlikely]] { device->BufferList.pop_back(); return false; @@ -467,10 +467,10 @@ inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= device->BufferList.size()) [[alunlikely]] + if(lidx >= device->BufferList.size()) [[unlikely]] return nullptr; BufferSubList &sublist = device->BufferList[lidx]; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.Buffers + slidx; } @@ -531,13 +531,13 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, UserFmtChannels SrcChannels, UserFmtType SrcType, const al::byte *SrcData, ALbitfieldSOFT access) { - if(ReadRef(ALBuf->ref) != 0 || ALBuf->MappedAccess != 0) [[alunlikely]] + if(ReadRef(ALBuf->ref) != 0 || ALBuf->MappedAccess != 0) [[unlikely]] SETERR_RETURN(context, AL_INVALID_OPERATION,, "Modifying storage for in-use buffer %u", ALBuf->id); /* Currently no channel configurations need to be converted. */ auto DstChannels = FmtFromUserFmt(SrcChannels); - if(!DstChannels) [[alunlikely]] + if(!DstChannels) [[unlikely]] SETERR_RETURN(context, AL_INVALID_ENUM, , "Invalid format"); /* IMA4 and MSADPCM convert to 16-bit short. @@ -548,18 +548,18 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, */ if((access&MAP_READ_WRITE_FLAGS)) { - if(SrcType == UserFmtIMA4 || SrcType == UserFmtMSADPCM) [[alunlikely]] + if(SrcType == UserFmtIMA4 || SrcType == UserFmtMSADPCM) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "%s samples cannot be mapped", NameFromUserFmtType(SrcType)); } auto DstType = (SrcType == UserFmtIMA4 || SrcType == UserFmtMSADPCM) ? al::make_optional(FmtShort) : FmtFromUserFmt(SrcType); - if(!DstType) [[alunlikely]] + if(!DstType) [[unlikely]] SETERR_RETURN(context, AL_INVALID_ENUM, , "Invalid format"); const ALuint unpackalign{ALBuf->UnpackAlign}; const ALuint align{SanitizeAlignment(SrcType, unpackalign)}; - if(align < 1) [[alunlikely]] + if(align < 1) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid unpack alignment %u for %s samples", unpackalign, NameFromUserFmtType(SrcType)); @@ -569,9 +569,9 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, if((access&AL_PRESERVE_DATA_BIT_SOFT)) { /* Can only preserve data with the same format and alignment. */ - if(ALBuf->mChannels != *DstChannels || ALBuf->OriginalType != SrcType) [[alunlikely]] + if(ALBuf->mChannels != *DstChannels || ALBuf->OriginalType != SrcType) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched format"); - if(ALBuf->OriginalAlign != align) [[alunlikely]] + if(ALBuf->OriginalAlign != align) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched alignment"); if(ALBuf->mAmbiOrder != ambiorder) SETERR_RETURN(context, AL_INVALID_VALUE,, "Preserving data of mismatched order"); @@ -584,12 +584,12 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, ((SrcType == UserFmtIMA4) ? (align-1)/2 + 4 : (SrcType == UserFmtMSADPCM) ? (align-2)/2 + 7 : (align * BytesFromUserFmt(SrcType)))}; - if((size%SrcByteAlign) != 0) [[alunlikely]] + if((size%SrcByteAlign) != 0) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Data size %d is not a multiple of frame size %d (%d unpack alignment)", size, SrcByteAlign, align); - if(size/SrcByteAlign > std::numeric_limits<ALsizei>::max()/align) [[alunlikely]] + if(size/SrcByteAlign > std::numeric_limits<ALsizei>::max()/align) [[unlikely]] SETERR_RETURN(context, AL_OUT_OF_MEMORY,, "Buffer size overflow, %d blocks x %d samples per block", size/SrcByteAlign, align); const ALuint frames{size / SrcByteAlign * align}; @@ -599,7 +599,7 @@ void LoadData(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, ALuint size, */ ALuint NumChannels{ChannelsFromFmt(*DstChannels, ambiorder)}; ALuint FrameSize{NumChannels * BytesFromFmt(*DstType)}; - if(frames > std::numeric_limits<size_t>::max()/FrameSize) [[alunlikely]] + if(frames > std::numeric_limits<size_t>::max()/FrameSize) [[unlikely]] SETERR_RETURN(context, AL_OUT_OF_MEMORY,, "Buffer size overflow, %d frames x %d bytes per frame", frames, FrameSize); size_t newsize{static_cast<size_t>(frames) * FrameSize}; @@ -686,18 +686,18 @@ void PrepareCallback(ALCcontext *context, ALbuffer *ALBuf, ALsizei freq, UserFmtChannels SrcChannels, UserFmtType SrcType, ALBUFFERCALLBACKTYPESOFT callback, void *userptr) { - if(ReadRef(ALBuf->ref) != 0 || ALBuf->MappedAccess != 0) [[alunlikely]] + if(ReadRef(ALBuf->ref) != 0 || ALBuf->MappedAccess != 0) [[unlikely]] SETERR_RETURN(context, AL_INVALID_OPERATION,, "Modifying callback for in-use buffer %u", ALBuf->id); /* Currently no channel configurations need to be converted. */ auto DstChannels = FmtFromUserFmt(SrcChannels); - if(!DstChannels) [[alunlikely]] + if(!DstChannels) [[unlikely]] SETERR_RETURN(context, AL_INVALID_ENUM,, "Invalid format"); /* IMA4 and MSADPCM convert to 16-bit short. Not supported with callbacks. */ auto DstType = FmtFromUserFmt(SrcType); - if(!DstType) [[alunlikely]] + if(!DstType) [[unlikely]] SETERR_RETURN(context, AL_INVALID_ENUM,, "Unsupported callback format"); const ALuint ambiorder{IsBFormat(*DstChannels) ? ALBuf->UnpackAmbiOrder : @@ -823,11 +823,11 @@ AL_API void AL_APIENTRY alGenBuffers(ALsizei n, ALuint *buffers) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Generating %d buffers", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; @@ -837,7 +837,7 @@ START_API_FUNC return; } - if(n == 1) [[allikely]] + if(n == 1) [[likely]] { /* Special handling for the easy and normal case. */ ALbuffer *buffer{AllocBuffer(device)}; @@ -863,11 +863,11 @@ AL_API void AL_APIENTRY alDeleteBuffers(ALsizei n, const ALuint *buffers) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Deleting %d buffers", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; @@ -877,12 +877,12 @@ START_API_FUNC { if(!bid) return true; ALbuffer *ALBuf{LookupBuffer(device, bid)}; - if(!ALBuf) [[alunlikely]] + if(!ALBuf) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", bid); return false; } - if(ReadRef(ALBuf->ref) != 0) [[alunlikely]] + if(ReadRef(ALBuf->ref) != 0) [[unlikely]] { context->setError(AL_INVALID_OPERATION, "Deleting in-use buffer %u", bid); return false; @@ -891,7 +891,7 @@ START_API_FUNC }; const ALuint *buffers_end = buffers + n; auto invbuf = std::find_if_not(buffers, buffers_end, validate_buffer); - if(invbuf != buffers_end) [[alunlikely]] return; + if(invbuf != buffers_end) [[unlikely]] return; /* All good. Delete non-0 buffer IDs. */ auto delete_buffer = [device](const ALuint bid) -> void @@ -907,7 +907,7 @@ AL_API ALboolean AL_APIENTRY alIsBuffer(ALuint buffer) START_API_FUNC { ContextRef context{GetContextRef()}; - if(context) [[allikely]] + if(context) [[likely]] { ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; @@ -928,28 +928,28 @@ AL_API void AL_APIENTRY alBufferStorageSOFT(ALuint buffer, ALenum format, const START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(size < 0) [[alunlikely]] + else if(size < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Negative storage size %d", size); - else if(freq < 1) [[alunlikely]] + else if(freq < 1) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid sample rate %d", freq); - else if((flags&INVALID_STORAGE_MASK) != 0) [[alunlikely]] + else if((flags&INVALID_STORAGE_MASK) != 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid storage flags 0x%x", flags&INVALID_STORAGE_MASK); - else if((flags&AL_MAP_PERSISTENT_BIT_SOFT) && !(flags&MAP_READ_WRITE_FLAGS)) [[alunlikely]] + else if((flags&AL_MAP_PERSISTENT_BIT_SOFT) && !(flags&MAP_READ_WRITE_FLAGS)) [[unlikely]] context->setError(AL_INVALID_VALUE, "Declaring persistently mapped storage without read or write access"); else { auto usrfmt = DecomposeUserFormat(format); - if(!usrfmt) [[alunlikely]] + if(!usrfmt) [[unlikely]] context->setError(AL_INVALID_ENUM, "Invalid format 0x%04x", format); else { @@ -964,40 +964,40 @@ AL_API void* AL_APIENTRY alMapBufferSOFT(ALuint buffer, ALsizei offset, ALsizei START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return nullptr; + if(!context) [[unlikely]] return nullptr; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if((access&INVALID_MAP_FLAGS) != 0) [[alunlikely]] + else if((access&INVALID_MAP_FLAGS) != 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid map flags 0x%x", access&INVALID_MAP_FLAGS); - else if(!(access&MAP_READ_WRITE_FLAGS)) [[alunlikely]] + else if(!(access&MAP_READ_WRITE_FLAGS)) [[unlikely]] context->setError(AL_INVALID_VALUE, "Mapping buffer %u without read or write access", buffer); else { ALbitfieldSOFT unavailable = (albuf->Access^access) & access; - if(ReadRef(albuf->ref) != 0 && !(access&AL_MAP_PERSISTENT_BIT_SOFT)) [[alunlikely]] + if(ReadRef(albuf->ref) != 0 && !(access&AL_MAP_PERSISTENT_BIT_SOFT)) [[unlikely]] context->setError(AL_INVALID_OPERATION, "Mapping in-use buffer %u without persistent mapping", buffer); - else if(albuf->MappedAccess != 0) [[alunlikely]] + else if(albuf->MappedAccess != 0) [[unlikely]] context->setError(AL_INVALID_OPERATION, "Mapping already-mapped buffer %u", buffer); - else if((unavailable&AL_MAP_READ_BIT_SOFT)) [[alunlikely]] + else if((unavailable&AL_MAP_READ_BIT_SOFT)) [[unlikely]] context->setError(AL_INVALID_VALUE, "Mapping buffer %u for reading without read access", buffer); - else if((unavailable&AL_MAP_WRITE_BIT_SOFT)) [[alunlikely]] + else if((unavailable&AL_MAP_WRITE_BIT_SOFT)) [[unlikely]] context->setError(AL_INVALID_VALUE, "Mapping buffer %u for writing without write access", buffer); - else if((unavailable&AL_MAP_PERSISTENT_BIT_SOFT)) [[alunlikely]] + else if((unavailable&AL_MAP_PERSISTENT_BIT_SOFT)) [[unlikely]] context->setError(AL_INVALID_VALUE, "Mapping buffer %u persistently without persistent access", buffer); else if(offset < 0 || length <= 0 || static_cast<ALuint>(offset) >= albuf->OriginalSize || static_cast<ALuint>(length) > albuf->OriginalSize - static_cast<ALuint>(offset)) - [[alunlikely]] + [[unlikely]] context->setError(AL_INVALID_VALUE, "Mapping invalid range %d+%d for buffer %u", offset, length, buffer); else @@ -1018,15 +1018,15 @@ AL_API void AL_APIENTRY alUnmapBufferSOFT(ALuint buffer) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(albuf->MappedAccess == 0) [[alunlikely]] + else if(albuf->MappedAccess == 0) [[unlikely]] context->setError(AL_INVALID_OPERATION, "Unmapping unmapped buffer %u", buffer); else { @@ -1041,20 +1041,20 @@ AL_API void AL_APIENTRY alFlushMappedBufferSOFT(ALuint buffer, ALsizei offset, A START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!(albuf->MappedAccess&AL_MAP_WRITE_BIT_SOFT)) [[alunlikely]] + else if(!(albuf->MappedAccess&AL_MAP_WRITE_BIT_SOFT)) [[unlikely]] context->setError(AL_INVALID_OPERATION, "Flushing buffer %u while not mapped for writing", buffer); else if(offset < albuf->MappedOffset || length <= 0 || offset >= albuf->MappedOffset+albuf->MappedSize - || length > albuf->MappedOffset+albuf->MappedSize-offset) [[alunlikely]] + || length > albuf->MappedOffset+albuf->MappedSize-offset) [[unlikely]] context->setError(AL_INVALID_VALUE, "Flushing invalid range %d+%d on buffer %u", offset, length, buffer); else @@ -1073,20 +1073,20 @@ AL_API void AL_APIENTRY alBufferSubDataSOFT(ALuint buffer, ALenum format, const START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); return; } auto usrfmt = DecomposeUserFormat(format); - if(!usrfmt) [[alunlikely]] + if(!usrfmt) [[unlikely]] { context->setError(AL_INVALID_ENUM, "Invalid format 0x%04x", format); return; @@ -1094,18 +1094,18 @@ START_API_FUNC ALuint unpack_align{albuf->UnpackAlign}; ALuint align{SanitizeAlignment(usrfmt->type, unpack_align)}; - if(align < 1) [[alunlikely]] + if(align < 1) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid unpack alignment %u", unpack_align); else if(long{usrfmt->channels} != long{albuf->mChannels} - || usrfmt->type != albuf->OriginalType) [[alunlikely]] + || usrfmt->type != albuf->OriginalType) [[unlikely]] context->setError(AL_INVALID_ENUM, "Unpacking data with mismatched format"); - else if(align != albuf->OriginalAlign) [[alunlikely]] + else if(align != albuf->OriginalAlign) [[unlikely]] context->setError(AL_INVALID_VALUE, "Unpacking data with alignment %u does not match original alignment %u", align, albuf->OriginalAlign); - else if(albuf->isBFormat() && albuf->UnpackAmbiOrder != albuf->mAmbiOrder) [[alunlikely]] + else if(albuf->isBFormat() && albuf->UnpackAmbiOrder != albuf->mAmbiOrder) [[unlikely]] context->setError(AL_INVALID_VALUE, "Unpacking data with mismatched ambisonic order"); - else if(albuf->MappedAccess != 0) [[alunlikely]] + else if(albuf->MappedAccess != 0) [[unlikely]] context->setError(AL_INVALID_OPERATION, "Unpacking data into mapped buffer %u", buffer); else { @@ -1119,14 +1119,14 @@ START_API_FUNC if(offset < 0 || length < 0 || static_cast<ALuint>(offset) > albuf->OriginalSize || static_cast<ALuint>(length) > albuf->OriginalSize-static_cast<ALuint>(offset)) - [[alunlikely]] + [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid data sub-range %d+%d on buffer %u", offset, length, buffer); - else if((static_cast<ALuint>(offset)%byte_align) != 0) [[alunlikely]] + else if((static_cast<ALuint>(offset)%byte_align) != 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Sub-range offset %d is not a multiple of frame size %d (%d unpack alignment)", offset, byte_align, align); - else if((static_cast<ALuint>(length)%byte_align) != 0) [[alunlikely]] + else if((static_cast<ALuint>(length)%byte_align) != 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Sub-range length %d is not a multiple of frame size %d (%d unpack alignment)", length, byte_align, align); @@ -1160,7 +1160,7 @@ AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint /*buffer*/, ALuint /*samplera START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; context->setError(AL_INVALID_OPERATION, "alBufferSamplesSOFT not supported"); } @@ -1171,7 +1171,7 @@ AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint /*buffer*/, ALsizei /*offs START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; context->setError(AL_INVALID_OPERATION, "alBufferSubSamplesSOFT not supported"); } @@ -1182,7 +1182,7 @@ AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint /*buffer*/, ALsizei /*offs START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; context->setError(AL_INVALID_OPERATION, "alGetBufferSamplesSOFT not supported"); } @@ -1192,7 +1192,7 @@ AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum /*format*/) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return AL_FALSE; + if(!context) [[unlikely]] return AL_FALSE; context->setError(AL_INVALID_OPERATION, "alIsBufferFormatSupportedSOFT not supported"); return AL_FALSE; @@ -1204,12 +1204,12 @@ AL_API void AL_APIENTRY alBufferf(ALuint buffer, ALenum param, ALfloat /*value*/ START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); else switch(param) { @@ -1224,12 +1224,12 @@ AL_API void AL_APIENTRY alBuffer3f(ALuint buffer, ALenum param, START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); else switch(param) { @@ -1243,14 +1243,14 @@ AL_API void AL_APIENTRY alBufferfv(ALuint buffer, ALenum param, const ALfloat *v START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1265,53 +1265,53 @@ AL_API void AL_APIENTRY alBufferi(ALuint buffer, ALenum param, ALint value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); else switch(param) { case AL_UNPACK_BLOCK_ALIGNMENT_SOFT: - if(value < 0) [[alunlikely]] + if(value < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid unpack block alignment %d", value); else albuf->UnpackAlign = static_cast<ALuint>(value); break; case AL_PACK_BLOCK_ALIGNMENT_SOFT: - if(value < 0) [[alunlikely]] + if(value < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid pack block alignment %d", value); else albuf->PackAlign = static_cast<ALuint>(value); break; case AL_AMBISONIC_LAYOUT_SOFT: - if(ReadRef(albuf->ref) != 0) [[alunlikely]] + if(ReadRef(albuf->ref) != 0) [[unlikely]] context->setError(AL_INVALID_OPERATION, "Modifying in-use buffer %u's ambisonic layout", buffer); - else if(value != AL_FUMA_SOFT && value != AL_ACN_SOFT) [[alunlikely]] + else if(value != AL_FUMA_SOFT && value != AL_ACN_SOFT) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid unpack ambisonic layout %04x", value); else albuf->mAmbiLayout = AmbiLayoutFromEnum(value).value(); break; case AL_AMBISONIC_SCALING_SOFT: - if(ReadRef(albuf->ref) != 0) [[alunlikely]] + if(ReadRef(albuf->ref) != 0) [[unlikely]] context->setError(AL_INVALID_OPERATION, "Modifying in-use buffer %u's ambisonic scaling", buffer); else if(value != AL_FUMA_SOFT && value != AL_SN3D_SOFT && value != AL_N3D_SOFT) - [[alunlikely]] + [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid unpack ambisonic scaling %04x", value); else albuf->mAmbiScaling = AmbiScalingFromEnum(value).value(); break; case AL_UNPACK_AMBISONIC_ORDER_SOFT: - if(value < 1 || value > 14) [[alunlikely]] + if(value < 1 || value > 14) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid unpack ambisonic order %d", value); else albuf->UnpackAmbiOrder = static_cast<ALuint>(value); @@ -1328,12 +1328,12 @@ AL_API void AL_APIENTRY alBuffer3i(ALuint buffer, ALenum param, START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); else switch(param) { @@ -1361,24 +1361,24 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { case AL_LOOP_POINTS_SOFT: - if(ReadRef(albuf->ref) != 0) [[alunlikely]] + if(ReadRef(albuf->ref) != 0) [[unlikely]] context->setError(AL_INVALID_OPERATION, "Modifying in-use buffer %u's loop points", buffer); else if(values[0] < 0 || values[0] >= values[1] - || static_cast<ALuint>(values[1]) > albuf->mSampleLen) [[alunlikely]] + || static_cast<ALuint>(values[1]) > albuf->mSampleLen) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid loop point range %d -> %d on buffer %u", values[0], values[1], buffer); else @@ -1399,15 +1399,15 @@ AL_API void AL_APIENTRY alGetBufferf(ALuint buffer, ALenum param, ALfloat *value START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!value) [[alunlikely]] + else if(!value) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1421,14 +1421,14 @@ AL_API void AL_APIENTRY alGetBuffer3f(ALuint buffer, ALenum param, ALfloat *valu START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!value1 || !value2 || !value3) [[alunlikely]] + else if(!value1 || !value2 || !value3) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1449,14 +1449,14 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1471,14 +1471,14 @@ AL_API void AL_APIENTRY alGetBufferi(ALuint buffer, ALenum param, ALint *value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!value) [[alunlikely]] + else if(!value) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1528,13 +1528,13 @@ AL_API void AL_APIENTRY alGetBuffer3i(ALuint buffer, ALenum param, ALint *value1 START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!value1 || !value2 || !value3) [[alunlikely]] + else if(!value1 || !value2 || !value3) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1566,14 +1566,14 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1594,22 +1594,22 @@ AL_API void AL_APIENTRY alBufferCallbackSOFT(ALuint buffer, ALenum format, ALsiz START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(freq < 1) [[alunlikely]] + else if(freq < 1) [[unlikely]] context->setError(AL_INVALID_VALUE, "Invalid sample rate %d", freq); - else if(callback == nullptr) [[alunlikely]] + else if(callback == nullptr) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL callback"); else { auto usrfmt = DecomposeUserFormat(format); - if(!usrfmt) [[alunlikely]] + if(!usrfmt) [[unlikely]] context->setError(AL_INVALID_ENUM, "Invalid format 0x%04x", format); else PrepareCallback(context.get(), albuf, freq, usrfmt->channels, usrfmt->type, callback, @@ -1622,14 +1622,14 @@ AL_API void AL_APIENTRY alGetBufferPtrSOFT(ALuint buffer, ALenum param, ALvoid * START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; ALbuffer *albuf = LookupBuffer(device, buffer); - if(!albuf) [[alunlikely]] + if(!albuf) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!value) [[alunlikely]] + else if(!value) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1650,13 +1650,13 @@ AL_API void AL_APIENTRY alGetBuffer3PtrSOFT(ALuint buffer, ALenum param, ALvoid START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!value1 || !value2 || !value3) [[alunlikely]] + else if(!value1 || !value2 || !value3) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1678,13 +1678,13 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->BufferLock}; - if(LookupBuffer(device, buffer) == nullptr) [[alunlikely]] + if(LookupBuffer(device, buffer) == nullptr) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid buffer ID %u", buffer); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else switch(param) { @@ -1769,7 +1769,7 @@ START_API_FUNC continue; const auto al_buffer = LookupBuffer(device, buffer); - if(!al_buffer) [[alunlikely]] + if(!al_buffer) [[unlikely]] { ERR(EAX_PREFIX "Invalid buffer ID %u.\n", buffer); return ALC_FALSE; @@ -1785,7 +1785,7 @@ START_API_FUNC * buffer ID is specified multiple times in the provided list, it * counts each instance as more memory that needs to fit in X-RAM. */ - if(std::numeric_limits<size_t>::max()-al_buffer->OriginalSize < total_needed) [[alunlikely]] + if(std::numeric_limits<size_t>::max()-al_buffer->OriginalSize < total_needed) [[unlikely]] { context->setError(AL_OUT_OF_MEMORY, EAX_PREFIX "Buffer size overflow (%u + %zu)\n", al_buffer->OriginalSize, total_needed); diff --git a/al/effect.cpp b/al/effect.cpp index 7a3f872d..21387cae 100644 --- a/al/effect.cpp +++ b/al/effect.cpp @@ -166,14 +166,14 @@ bool EnsureEffects(ALCdevice *device, size_t needed) while(needed > count) { - if(device->EffectList.size() >= 1<<25) [[alunlikely]] + if(device->EffectList.size() >= 1<<25) [[unlikely]] return false; device->EffectList.emplace_back(); auto sublist = device->EffectList.end() - 1; sublist->FreeMask = ~0_u64; sublist->Effects = static_cast<ALeffect*>(al_calloc(alignof(ALeffect), sizeof(ALeffect)*64)); - if(!sublist->Effects) [[alunlikely]] + if(!sublist->Effects) [[unlikely]] { device->EffectList.pop_back(); return false; @@ -219,10 +219,10 @@ inline ALeffect *LookupEffect(ALCdevice *device, ALuint id) const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= device->EffectList.size()) [[alunlikely]] + if(lidx >= device->EffectList.size()) [[unlikely]] return nullptr; EffectSubList &sublist = device->EffectList[lidx]; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.Effects + slidx; } @@ -233,11 +233,11 @@ AL_API void AL_APIENTRY alGenEffects(ALsizei n, ALuint *effects) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Generating %d effects", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; @@ -247,7 +247,7 @@ START_API_FUNC return; } - if(n == 1) [[allikely]] + if(n == 1) [[likely]] { /* Special handling for the easy and normal case. */ ALeffect *effect{AllocEffect(device)}; @@ -273,11 +273,11 @@ AL_API void AL_APIENTRY alDeleteEffects(ALsizei n, const ALuint *effects) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Deleting %d effects", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; @@ -288,7 +288,7 @@ START_API_FUNC const ALuint *effects_end = effects + n; auto inveffect = std::find_if_not(effects, effects_end, validate_effect); - if(inveffect != effects_end) [[alunlikely]] + if(inveffect != effects_end) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid effect ID %u", *inveffect); return; @@ -308,7 +308,7 @@ AL_API ALboolean AL_APIENTRY alIsEffect(ALuint effect) START_API_FUNC { ContextRef context{GetContextRef()}; - if(context) [[allikely]] + if(context) [[likely]] { ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; @@ -323,13 +323,13 @@ AL_API void AL_APIENTRY alEffecti(ALuint effect, ALenum param, ALint value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; ALeffect *aleffect{LookupEffect(device, effect)}; - if(!aleffect) [[alunlikely]] + if(!aleffect) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect); else if(param == AL_EFFECT_TYPE) { @@ -373,13 +373,13 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; ALeffect *aleffect{LookupEffect(device, effect)}; - if(!aleffect) [[alunlikely]] + if(!aleffect) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect); else try { @@ -396,13 +396,13 @@ AL_API void AL_APIENTRY alEffectf(ALuint effect, ALenum param, ALfloat value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; ALeffect *aleffect{LookupEffect(device, effect)}; - if(!aleffect) [[alunlikely]] + if(!aleffect) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect); else try { @@ -419,13 +419,13 @@ AL_API void AL_APIENTRY alEffectfv(ALuint effect, ALenum param, const ALfloat *v START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; ALeffect *aleffect{LookupEffect(device, effect)}; - if(!aleffect) [[alunlikely]] + if(!aleffect) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect); else try { @@ -442,13 +442,13 @@ AL_API void AL_APIENTRY alGetEffecti(ALuint effect, ALenum param, ALint *value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; const ALeffect *aleffect{LookupEffect(device, effect)}; - if(!aleffect) [[alunlikely]] + if(!aleffect) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect); else if(param == AL_EFFECT_TYPE) *value = aleffect->type; @@ -474,13 +474,13 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; const ALeffect *aleffect{LookupEffect(device, effect)}; - if(!aleffect) [[alunlikely]] + if(!aleffect) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect); else try { @@ -497,13 +497,13 @@ AL_API void AL_APIENTRY alGetEffectf(ALuint effect, ALenum param, ALfloat *value START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; const ALeffect *aleffect{LookupEffect(device, effect)}; - if(!aleffect) [[alunlikely]] + if(!aleffect) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect); else try { @@ -520,13 +520,13 @@ AL_API void AL_APIENTRY alGetEffectfv(ALuint effect, ALenum param, ALfloat *valu START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->EffectLock}; const ALeffect *aleffect{LookupEffect(device, effect)}; - if(!aleffect) [[alunlikely]] + if(!aleffect) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid effect ID %u", effect); else try { diff --git a/al/error.cpp b/al/error.cpp index 5817e153..0340f430 100644 --- a/al/error.cpp +++ b/al/error.cpp @@ -85,7 +85,7 @@ AL_API ALenum AL_APIENTRY alGetError(void) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] + if(!context) [[unlikely]] { static constexpr ALenum deferror{AL_INVALID_OPERATION}; WARN("Querying error state on null context (implicitly 0x%04x)\n", deferror); diff --git a/al/event.cpp b/al/event.cpp index 1e31a144..1ec404da 100644 --- a/al/event.cpp +++ b/al/event.cpp @@ -35,7 +35,7 @@ static int EventThread(ALCcontext *context) { RingBuffer *ring{context->mAsyncEvents.get()}; bool quitnow{false}; - while(!quitnow) [[allikely]] + while(!quitnow) [[likely]] { auto evt_data = ring->getReadVector().first; if(evt_data.len == 0) @@ -55,7 +55,7 @@ static int EventThread(ALCcontext *context) ring->readAdvance(1); quitnow = evt.EnumType == AsyncEvent::KillThread; - if(quitnow) [[alunlikely]] break; + if(quitnow) [[unlikely]] break; if(evt.EnumType == AsyncEvent::ReleaseEffectState) { @@ -155,7 +155,7 @@ AL_API void AL_APIENTRY alEventControlSOFT(ALsizei count, const ALenum *types, A START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(count < 0) context->setError(AL_INVALID_VALUE, "Controlling %d events", count); if(count <= 0) return; @@ -210,7 +210,7 @@ AL_API void AL_APIENTRY alEventCallbackSOFT(ALEVENTPROCSOFT callback, void *user START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mEventCbLock}; diff --git a/al/extension.cpp b/al/extension.cpp index 4327b082..3d01d6c1 100644 --- a/al/extension.cpp +++ b/al/extension.cpp @@ -37,9 +37,9 @@ AL_API ALboolean AL_APIENTRY alIsExtensionPresent(const ALchar *extName) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return AL_FALSE; + if(!context) [[unlikely]] return AL_FALSE; - if(!extName) [[alunlikely]] + if(!extName) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE, AL_FALSE, "NULL pointer"); size_t len{strlen(extName)}; diff --git a/al/filter.cpp b/al/filter.cpp index f0274ed7..298bef5d 100644 --- a/al/filter.cpp +++ b/al/filter.cpp @@ -331,14 +331,14 @@ bool EnsureFilters(ALCdevice *device, size_t needed) while(needed > count) { - if(device->FilterList.size() >= 1<<25) [[alunlikely]] + if(device->FilterList.size() >= 1<<25) [[unlikely]] return false; device->FilterList.emplace_back(); auto sublist = device->FilterList.end() - 1; sublist->FreeMask = ~0_u64; sublist->Filters = static_cast<ALfilter*>(al_calloc(alignof(ALfilter), sizeof(ALfilter)*64)); - if(!sublist->Filters) [[alunlikely]] + if(!sublist->Filters) [[unlikely]] { device->FilterList.pop_back(); return false; @@ -386,10 +386,10 @@ inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= device->FilterList.size()) [[alunlikely]] + if(lidx >= device->FilterList.size()) [[unlikely]] return nullptr; FilterSubList &sublist = device->FilterList[lidx]; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.Filters + slidx; } @@ -400,11 +400,11 @@ AL_API void AL_APIENTRY alGenFilters(ALsizei n, ALuint *filters) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Generating %d filters", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; @@ -414,7 +414,7 @@ START_API_FUNC return; } - if(n == 1) [[allikely]] + if(n == 1) [[likely]] { /* Special handling for the easy and normal case. */ ALfilter *filter{AllocFilter(device)}; @@ -440,11 +440,11 @@ AL_API void AL_APIENTRY alDeleteFilters(ALsizei n, const ALuint *filters) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Deleting %d filters", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; @@ -455,7 +455,7 @@ START_API_FUNC const ALuint *filters_end = filters + n; auto invflt = std::find_if_not(filters, filters_end, validate_filter); - if(invflt != filters_end) [[alunlikely]] + if(invflt != filters_end) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid filter ID %u", *invflt); return; @@ -475,7 +475,7 @@ AL_API ALboolean AL_APIENTRY alIsFilter(ALuint filter) START_API_FUNC { ContextRef context{GetContextRef()}; - if(context) [[allikely]] + if(context) [[likely]] { ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; @@ -491,13 +491,13 @@ AL_API void AL_APIENTRY alFilteri(ALuint filter, ALenum param, ALint value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; - if(!alfilt) [[alunlikely]] + if(!alfilt) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter); else { @@ -532,13 +532,13 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; - if(!alfilt) [[alunlikely]] + if(!alfilt) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter); else try { @@ -555,13 +555,13 @@ AL_API void AL_APIENTRY alFilterf(ALuint filter, ALenum param, ALfloat value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; - if(!alfilt) [[alunlikely]] + if(!alfilt) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter); else try { @@ -578,13 +578,13 @@ AL_API void AL_APIENTRY alFilterfv(ALuint filter, ALenum param, const ALfloat *v START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; ALfilter *alfilt{LookupFilter(device, filter)}; - if(!alfilt) [[alunlikely]] + if(!alfilt) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter); else try { @@ -601,13 +601,13 @@ AL_API void AL_APIENTRY alGetFilteri(ALuint filter, ALenum param, ALint *value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; const ALfilter *alfilt{LookupFilter(device, filter)}; - if(!alfilt) [[alunlikely]] + if(!alfilt) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter); else { @@ -636,13 +636,13 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; const ALfilter *alfilt{LookupFilter(device, filter)}; - if(!alfilt) [[alunlikely]] + if(!alfilt) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter); else try { @@ -659,13 +659,13 @@ AL_API void AL_APIENTRY alGetFilterf(ALuint filter, ALenum param, ALfloat *value START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; const ALfilter *alfilt{LookupFilter(device, filter)}; - if(!alfilt) [[alunlikely]] + if(!alfilt) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter); else try { @@ -682,13 +682,13 @@ AL_API void AL_APIENTRY alGetFilterfv(ALuint filter, ALenum param, ALfloat *valu START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALCdevice *device{context->mALDevice.get()}; std::lock_guard<std::mutex> _{device->FilterLock}; const ALfilter *alfilt{LookupFilter(device, filter)}; - if(!alfilt) [[alunlikely]] + if(!alfilt) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid filter ID %u", filter); else try { diff --git a/al/listener.cpp b/al/listener.cpp index a71e2999..fb17ad55 100644 --- a/al/listener.cpp +++ b/al/listener.cpp @@ -81,7 +81,7 @@ AL_API void AL_APIENTRY alListenerf(ALenum param, ALfloat value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALlistener &listener = context->mListener; std::lock_guard<std::mutex> _{context->mPropLock}; @@ -111,7 +111,7 @@ AL_API void AL_APIENTRY alListener3f(ALenum param, ALfloat value1, ALfloat value START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALlistener &listener = context->mListener; std::lock_guard<std::mutex> _{context->mPropLock}; @@ -161,7 +161,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALlistener &listener = context->mListener; std::lock_guard<std::mutex> _{context->mPropLock}; @@ -193,7 +193,7 @@ AL_API void AL_APIENTRY alListeneri(ALenum param, ALint /*value*/) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; switch(param) @@ -216,7 +216,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; switch(param) @@ -253,7 +253,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; if(!values) @@ -271,7 +271,7 @@ AL_API void AL_APIENTRY alGetListenerf(ALenum param, ALfloat *value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALlistener &listener = context->mListener; std::lock_guard<std::mutex> _{context->mPropLock}; @@ -297,7 +297,7 @@ AL_API void AL_APIENTRY alGetListener3f(ALenum param, ALfloat *value1, ALfloat * START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALlistener &listener = context->mListener; std::lock_guard<std::mutex> _{context->mPropLock}; @@ -340,7 +340,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALlistener &listener = context->mListener; std::lock_guard<std::mutex> _{context->mPropLock}; @@ -369,7 +369,7 @@ AL_API void AL_APIENTRY alGetListeneri(ALenum param, ALint *value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; if(!value) @@ -386,7 +386,7 @@ AL_API void AL_APIENTRY alGetListener3i(ALenum param, ALint *value1, ALint *valu START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALlistener &listener = context->mListener; std::lock_guard<std::mutex> _{context->mPropLock}; @@ -424,7 +424,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; ALlistener &listener = context->mListener; std::lock_guard<std::mutex> _{context->mPropLock}; diff --git a/al/source.cpp b/al/source.cpp index 3621157f..477fdb5d 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -551,7 +551,7 @@ void InitVoice(Voice *voice, ALsource *source, ALbufferQueueItem *BufferList, AL VoiceChange *GetVoiceChanger(ALCcontext *ctx) { VoiceChange *vchg{ctx->mVoiceChangeTail}; - if(vchg == ctx->mCurrentVoiceChange.load(std::memory_order_acquire)) [[alunlikely]] + if(vchg == ctx->mCurrentVoiceChange.load(std::memory_order_acquire)) [[unlikely]] { ctx->allocVoiceChanges(); vchg = ctx->mVoiceChangeTail; @@ -573,7 +573,7 @@ void SendVoiceChanges(ALCcontext *ctx, VoiceChange *tail) const bool connected{device->Connected.load(std::memory_order_acquire)}; device->waitForMix(); - if(!connected) [[alunlikely]] + if(!connected) [[unlikely]] { if(ctx->mStopVoicesOnDisconnect.load(std::memory_order_acquire)) { @@ -611,7 +611,7 @@ bool SetVoiceOffset(Voice *oldvoice, const VoicePos &vpos, ALsource *source, ALC } ++vidx; } - if(!newvoice) [[alunlikely]] + if(!newvoice) [[unlikely]] { auto &allvoices = *context->mVoices.load(std::memory_order_relaxed); if(allvoices.size() == voicelist.size()) @@ -667,7 +667,7 @@ bool SetVoiceOffset(Voice *oldvoice, const VoicePos &vpos, ALsource *source, ALC /* If the old voice still has a sourceID, it's still active and the change- * over will work on the next update. */ - if(oldvoice->mSourceID.load(std::memory_order_acquire) != 0u) [[allikely]] + if(oldvoice->mSourceID.load(std::memory_order_acquire) != 0u) [[likely]] return true; /* Otherwise, if the new voice's state is not pending, the change-over @@ -720,14 +720,14 @@ bool EnsureSources(ALCcontext *context, size_t needed) while(needed > count) { - if(context->mSourceList.size() >= 1<<25) [[alunlikely]] + if(context->mSourceList.size() >= 1<<25) [[unlikely]] return false; context->mSourceList.emplace_back(); auto sublist = context->mSourceList.end() - 1; sublist->FreeMask = ~0_u64; sublist->Sources = static_cast<ALsource*>(al_calloc(alignof(ALsource), sizeof(ALsource)*64)); - if(!sublist->Sources) [[alunlikely]] + if(!sublist->Sources) [[unlikely]] { context->mSourceList.pop_back(); return false; @@ -787,10 +787,10 @@ inline ALsource *LookupSource(ALCcontext *context, ALuint id) noexcept const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= context->mSourceList.size()) [[alunlikely]] + if(lidx >= context->mSourceList.size()) [[unlikely]] return nullptr; SourceSubList &sublist{context->mSourceList[lidx]}; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.Sources + slidx; } @@ -800,10 +800,10 @@ inline ALbuffer *LookupBuffer(ALCdevice *device, ALuint id) noexcept const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= device->BufferList.size()) [[alunlikely]] + if(lidx >= device->BufferList.size()) [[unlikely]] return nullptr; BufferSubList &sublist = device->BufferList[lidx]; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.Buffers + slidx; } @@ -813,10 +813,10 @@ inline ALfilter *LookupFilter(ALCdevice *device, ALuint id) noexcept const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= device->FilterList.size()) [[alunlikely]] + if(lidx >= device->FilterList.size()) [[unlikely]] return nullptr; FilterSubList &sublist = device->FilterList[lidx]; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.Filters + slidx; } @@ -826,10 +826,10 @@ inline ALeffectslot *LookupEffectSlot(ALCcontext *context, ALuint id) noexcept const size_t lidx{(id-1) >> 6}; const ALuint slidx{(id-1) & 0x3f}; - if(lidx >= context->mEffectSlotList.size()) [[alunlikely]] + if(lidx >= context->mEffectSlotList.size()) [[unlikely]] return nullptr; EffectSlotSubList &sublist{context->mEffectSlotList[lidx]}; - if(sublist.FreeMask & (1_u64 << slidx)) [[alunlikely]] + if(sublist.FreeMask & (1_u64 << slidx)) [[unlikely]] return nullptr; return sublist.EffectSlots + slidx; } @@ -1147,14 +1147,14 @@ void SetSourceiv(ALsource *Source, ALCcontext *Context, SourceProp prop, const a void SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, const al::span<const int64_t> values); #define CHECKSIZE(v, s) do { \ - if((v).size() == (s) || (v).size() == MaxValues) [[allikely]] break; \ + if((v).size() == (s) || (v).size() == MaxValues) [[likely]] break; \ Context->setError(AL_INVALID_ENUM, \ "Property 0x%04x expects %d value(s), got %zu", prop, (s), \ (v).size()); \ return; \ } while(0) #define CHECKVAL(x) do { \ - if(x) [[allikely]] break; \ + if(x) [[likely]] break; \ Context->setError(AL_INVALID_VALUE, "Value out of range"); \ return; \ } while(0) @@ -1880,7 +1880,7 @@ void SetSourcei64v(ALsource *Source, ALCcontext *Context, SourceProp prop, #undef CHECKSIZE #define CHECKSIZE(v, s) do { \ - if((v).size() == (s) || (v).size() == MaxValues) [[allikely]] break; \ + if((v).size() == (s) || (v).size() == MaxValues) [[likely]] break; \ Context->setError(AL_INVALID_ENUM, \ "Property 0x%04x expects %d value(s), got %zu", prop, (s), \ (v).size()); \ @@ -2440,7 +2440,7 @@ void StartSources(ALCcontext *context, const al::span<ALsource*> srchandles, /* If the device is disconnected, and voices stop on disconnect, go right * to stopped. */ - if(!device->Connected.load(std::memory_order_acquire)) [[alunlikely]] + if(!device->Connected.load(std::memory_order_acquire)) [[unlikely]] { if(context->mStopVoicesOnDisconnect.load(std::memory_order_acquire)) { @@ -2466,7 +2466,7 @@ void StartSources(ALCcontext *context, const al::span<ALsource*> srchandles, if(free_voices == srchandles.size()) break; } - if(srchandles.size() != free_voices) [[alunlikely]] + if(srchandles.size() != free_voices) [[unlikely]] { const size_t inc_amount{srchandles.size() - free_voices}; auto &allvoices = *context->mVoices.load(std::memory_order_relaxed); @@ -2495,7 +2495,7 @@ void StartSources(ALCcontext *context, const al::span<ALsource*> srchandles, } /* If there's nothing to play, go right to stopped. */ - if(BufferList == source->mQueue.end()) [[alunlikely]] + if(BufferList == source->mQueue.end()) [[unlikely]] { /* NOTE: A source without any playable buffers should not have a * Voice since it shouldn't be in a playing or paused state. So @@ -2600,7 +2600,7 @@ void StartSources(ALCcontext *context, const al::span<ALsource*> srchandles, cur->mSourceID = source->id; cur->mState = VChangeState::Play; } - if(tail) [[allikely]] + if(tail) [[likely]] SendVoiceChanges(context, tail); } @@ -2610,11 +2610,11 @@ AL_API void AL_APIENTRY alGenSources(ALsizei n, ALuint *sources) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Generating %d sources", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; #ifdef ALSOFT_EAX const bool has_eax{context->has_eax()}; @@ -2679,9 +2679,9 @@ AL_API void AL_APIENTRY alDeleteSources(ALsizei n, const ALuint *sources) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Deleting %d sources", n); std::lock_guard<std::mutex> _{context->mSourceLock}; @@ -2692,7 +2692,7 @@ START_API_FUNC const ALuint *sources_end = sources + n; auto invsrc = std::find_if_not(sources, sources_end, validate_source); - if(invsrc != sources_end) [[alunlikely]] + if(invsrc != sources_end) [[unlikely]] { context->setError(AL_INVALID_NAME, "Invalid source ID %u", *invsrc); return; @@ -2712,7 +2712,7 @@ AL_API ALboolean AL_APIENTRY alIsSource(ALuint source) START_API_FUNC { ContextRef context{GetContextRef()}; - if(context) [[allikely]] + if(context) [[likely]] { std::lock_guard<std::mutex> _{context->mSourceLock}; if(LookupSource(context.get(), source) != nullptr) @@ -2727,12 +2727,12 @@ AL_API void AL_APIENTRY alSourcef(ALuint source, ALenum param, ALfloat value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); else SetSourcefv(Source, context.get(), static_cast<SourceProp>(param), {&value, 1u}); @@ -2743,12 +2743,12 @@ AL_API void AL_APIENTRY alSource3f(ALuint source, ALenum param, ALfloat value1, START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); else { @@ -2762,14 +2762,14 @@ AL_API void AL_APIENTRY alSourcefv(ALuint source, ALenum param, const ALfloat *v START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else SetSourcefv(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues}); @@ -2781,12 +2781,12 @@ AL_API void AL_APIENTRY alSourcedSOFT(ALuint source, ALenum param, ALdouble valu START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); else { @@ -2800,12 +2800,12 @@ AL_API void AL_APIENTRY alSource3dSOFT(ALuint source, ALenum param, ALdouble val START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); else { @@ -2820,14 +2820,14 @@ AL_API void AL_APIENTRY alSourcedvSOFT(ALuint source, ALenum param, const ALdoub START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else { @@ -2845,12 +2845,12 @@ AL_API void AL_APIENTRY alSourcei(ALuint source, ALenum param, ALint value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); else SetSourceiv(Source, context.get(), static_cast<SourceProp>(param), {&value, 1u}); @@ -2861,12 +2861,12 @@ AL_API void AL_APIENTRY alSource3i(ALuint source, ALenum param, ALint value1, AL START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); else { @@ -2880,14 +2880,14 @@ AL_API void AL_APIENTRY alSourceiv(ALuint source, ALenum param, const ALint *val START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source = LookupSource(context.get(), source); - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else SetSourceiv(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues}); @@ -2899,12 +2899,12 @@ AL_API void AL_APIENTRY alSourcei64SOFT(ALuint source, ALenum param, ALint64SOFT START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); else SetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), {&value, 1u}); @@ -2915,12 +2915,12 @@ AL_API void AL_APIENTRY alSource3i64SOFT(ALuint source, ALenum param, ALint64SOF START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); else { @@ -2934,14 +2934,14 @@ AL_API void AL_APIENTRY alSourcei64vSOFT(ALuint source, ALenum param, const ALin START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; std::lock_guard<std::mutex> __{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else SetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues}); @@ -2953,13 +2953,13 @@ AL_API void AL_APIENTRY alGetSourcef(ALuint source, ALenum param, ALfloat *value START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!value) [[alunlikely]] + else if(!value) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else { @@ -2974,13 +2974,13 @@ AL_API void AL_APIENTRY alGetSource3f(ALuint source, ALenum param, ALfloat *valu START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!(value1 && value2 && value3)) [[alunlikely]] + else if(!(value1 && value2 && value3)) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else { @@ -2999,13 +2999,13 @@ AL_API void AL_APIENTRY alGetSourcefv(ALuint source, ALenum param, ALfloat *valu START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else { @@ -3025,13 +3025,13 @@ AL_API void AL_APIENTRY alGetSourcedSOFT(ALuint source, ALenum param, ALdouble * START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!value) [[alunlikely]] + else if(!value) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else GetSourcedv(Source, context.get(), static_cast<SourceProp>(param), {value, 1u}); @@ -3042,13 +3042,13 @@ AL_API void AL_APIENTRY alGetSource3dSOFT(ALuint source, ALenum param, ALdouble START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!(value1 && value2 && value3)) [[alunlikely]] + else if(!(value1 && value2 && value3)) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else { @@ -3067,13 +3067,13 @@ AL_API void AL_APIENTRY alGetSourcedvSOFT(ALuint source, ALenum param, ALdouble START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else GetSourcedv(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues}); @@ -3085,13 +3085,13 @@ AL_API void AL_APIENTRY alGetSourcei(ALuint source, ALenum param, ALint *value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!value) [[alunlikely]] + else if(!value) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else GetSourceiv(Source, context.get(), static_cast<SourceProp>(param), {value, 1u}); @@ -3102,13 +3102,13 @@ AL_API void AL_APIENTRY alGetSource3i(ALuint source, ALenum param, ALint *value1 START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!(value1 && value2 && value3)) [[alunlikely]] + else if(!(value1 && value2 && value3)) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else { @@ -3127,13 +3127,13 @@ AL_API void AL_APIENTRY alGetSourceiv(ALuint source, ALenum param, ALint *values START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else GetSourceiv(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues}); @@ -3145,13 +3145,13 @@ AL_API void AL_APIENTRY alGetSourcei64SOFT(ALuint source, ALenum param, ALint64S START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!value) [[alunlikely]] + else if(!value) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else GetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), {value, 1u}); @@ -3162,13 +3162,13 @@ AL_API void AL_APIENTRY alGetSource3i64SOFT(ALuint source, ALenum param, ALint64 START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!(value1 && value2 && value3)) [[alunlikely]] + else if(!(value1 && value2 && value3)) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else { @@ -3187,13 +3187,13 @@ AL_API void AL_APIENTRY alGetSourcei64vSOFT(ALuint source, ALenum param, ALint64 START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *Source{LookupSource(context.get(), source)}; - if(!Source) [[alunlikely]] + if(!Source) [[unlikely]] context->setError(AL_INVALID_NAME, "Invalid source ID %u", source); - else if(!values) [[alunlikely]] + else if(!values) [[unlikely]] context->setError(AL_INVALID_VALUE, "NULL pointer"); else GetSourcei64v(Source, context.get(), static_cast<SourceProp>(param), {values, MaxValues}); @@ -3205,7 +3205,7 @@ AL_API void AL_APIENTRY alSourcePlay(ALuint source) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *srchandle{LookupSource(context.get(), source)}; @@ -3220,9 +3220,9 @@ void AL_APIENTRY alSourcePlayAtTimeSOFT(ALuint source, ALint64SOFT start_time) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(start_time < 0) [[alunlikely]] + if(start_time < 0) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid time point %" PRId64, start_time); std::lock_guard<std::mutex> _{context->mSourceLock}; @@ -3238,16 +3238,16 @@ AL_API void AL_APIENTRY alSourcePlayv(ALsizei n, const ALuint *sources) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Playing %d sources", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; al::vector<ALsource*> extra_sources; std::array<ALsource*,8> source_storage; al::span<ALsource*> srchandles; - if(static_cast<ALuint>(n) <= source_storage.size()) [[allikely]] + if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]] srchandles = {source_storage.data(), static_cast<ALuint>(n)}; else { @@ -3259,7 +3259,7 @@ START_API_FUNC for(auto &srchdl : srchandles) { srchdl = LookupSource(context.get(), *sources); - if(!srchdl) [[alunlikely]] + if(!srchdl) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", *sources); ++sources; } @@ -3272,19 +3272,19 @@ void AL_APIENTRY alSourcePlayAtTimevSOFT(ALsizei n, const ALuint *sources, ALint START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Playing %d sources", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; - if(start_time < 0) [[alunlikely]] + if(start_time < 0) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Invalid time point %" PRId64, start_time); al::vector<ALsource*> extra_sources; std::array<ALsource*,8> source_storage; al::span<ALsource*> srchandles; - if(static_cast<ALuint>(n) <= source_storage.size()) [[allikely]] + if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]] srchandles = {source_storage.data(), static_cast<ALuint>(n)}; else { @@ -3315,16 +3315,16 @@ AL_API void AL_APIENTRY alSourcePausev(ALsizei n, const ALuint *sources) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Pausing %d sources", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; al::vector<ALsource*> extra_sources; std::array<ALsource*,8> source_storage; al::span<ALsource*> srchandles; - if(static_cast<ALuint>(n) <= source_storage.size()) [[allikely]] + if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]] srchandles = {source_storage.data(), static_cast<ALuint>(n)}; else { @@ -3363,7 +3363,7 @@ START_API_FUNC cur->mState = VChangeState::Pause; } } - if(tail) [[allikely]] + if(tail) [[likely]] { SendVoiceChanges(context.get(), tail); /* Second, now that the voice changes have been sent, because it's @@ -3391,16 +3391,16 @@ AL_API void AL_APIENTRY alSourceStopv(ALsizei n, const ALuint *sources) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Stopping %d sources", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; al::vector<ALsource*> extra_sources; std::array<ALsource*,8> source_storage; al::span<ALsource*> srchandles; - if(static_cast<ALuint>(n) <= source_storage.size()) [[allikely]] + if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]] srchandles = {source_storage.data(), static_cast<ALuint>(n)}; else { @@ -3439,7 +3439,7 @@ START_API_FUNC source->OffsetType = AL_NONE; source->VoiceIdx = INVALID_VOICE_IDX; } - if(tail) [[allikely]] + if(tail) [[likely]] SendVoiceChanges(context.get(), tail); } END_API_FUNC @@ -3454,16 +3454,16 @@ AL_API void AL_APIENTRY alSourceRewindv(ALsizei n, const ALuint *sources) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(n < 0) [[alunlikely]] + if(n < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Rewinding %d sources", n); - if(n <= 0) [[alunlikely]] return; + if(n <= 0) [[unlikely]] return; al::vector<ALsource*> extra_sources; std::array<ALsource*,8> source_storage; al::span<ALsource*> srchandles; - if(static_cast<ALuint>(n) <= source_storage.size()) [[allikely]] + if(static_cast<ALuint>(n) <= source_storage.size()) [[likely]] srchandles = {source_storage.data(), static_cast<ALuint>(n)}; else { @@ -3504,7 +3504,7 @@ START_API_FUNC source->OffsetType = AL_NONE; source->VoiceIdx = INVALID_VOICE_IDX; } - if(tail) [[allikely]] + if(tail) [[likely]] SendVoiceChanges(context.get(), tail); } END_API_FUNC @@ -3514,19 +3514,19 @@ AL_API void AL_APIENTRY alSourceQueueBuffers(ALuint src, ALsizei nb, const ALuin START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(nb < 0) [[alunlikely]] + if(nb < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Queueing %d buffers", nb); - if(nb <= 0) [[alunlikely]] return; + if(nb <= 0) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *source{LookupSource(context.get(),src)}; - if(!source) [[alunlikely]] + if(!source) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", src); /* Can't queue on a Static Source */ - if(source->SourceType == AL_STATIC) [[alunlikely]] + if(source->SourceType == AL_STATIC) [[unlikely]] SETERR_RETURN(context, AL_INVALID_OPERATION,, "Queueing onto static source %u", src); /* Check for a valid Buffer, for its frequency and format */ @@ -3593,7 +3593,7 @@ START_API_FUNC fmt_mismatch |= BufferFmt->mAmbiOrder != buffer->mAmbiOrder; fmt_mismatch |= BufferFmt->OriginalType != buffer->OriginalType; } - if(fmt_mismatch) [[alunlikely]] + if(fmt_mismatch) [[unlikely]] { context->setError(AL_INVALID_OPERATION, "Queueing buffer with mismatched format"); @@ -3629,26 +3629,26 @@ AL_API void AL_APIENTRY alSourceUnqueueBuffers(ALuint src, ALsizei nb, ALuint *b START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; - if(nb < 0) [[alunlikely]] + if(nb < 0) [[unlikely]] context->setError(AL_INVALID_VALUE, "Unqueueing %d buffers", nb); - if(nb <= 0) [[alunlikely]] return; + if(nb <= 0) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mSourceLock}; ALsource *source{LookupSource(context.get(),src)}; - if(!source) [[alunlikely]] + if(!source) [[unlikely]] SETERR_RETURN(context, AL_INVALID_NAME,, "Invalid source ID %u", src); - if(source->SourceType != AL_STREAMING) [[alunlikely]] + if(source->SourceType != AL_STREAMING) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Unqueueing from a non-streaming source %u", src); - if(source->Looping) [[alunlikely]] + if(source->Looping) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Unqueueing from looping source %u", src); /* Make sure enough buffers have been processed to unqueue. */ uint processed{0u}; - if(source->state != AL_INITIAL) [[allikely]] + if(source->state != AL_INITIAL) [[likely]] { VoiceBufferItem *Current{nullptr}; if(Voice *voice{GetSourceVoice(source, context.get())}) @@ -3660,7 +3660,7 @@ START_API_FUNC ++processed; } } - if(processed < static_cast<ALuint>(nb)) [[alunlikely]] + if(processed < static_cast<ALuint>(nb)) [[unlikely]] SETERR_RETURN(context, AL_INVALID_VALUE,, "Unqueueing %d buffer%s (only %u processed)", nb, (nb==1)?"":"s", processed); @@ -3683,7 +3683,7 @@ AL_API void AL_APIENTRY alSourceQueueBufferLayersSOFT(ALuint, ALsizei, const ALu START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; context->setError(AL_INVALID_OPERATION, "alSourceQueueBufferLayersSOFT not supported"); } diff --git a/al/state.cpp b/al/state.cpp index 581d5370..d1c5605d 100644 --- a/al/state.cpp +++ b/al/state.cpp @@ -158,7 +158,7 @@ AL_API void AL_APIENTRY alEnable(ALenum capability) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; switch(capability) { @@ -184,7 +184,7 @@ AL_API void AL_APIENTRY alDisable(ALenum capability) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; switch(capability) { @@ -210,7 +210,7 @@ AL_API ALboolean AL_APIENTRY alIsEnabled(ALenum capability) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return AL_FALSE; + if(!context) [[unlikely]] return AL_FALSE; std::lock_guard<std::mutex> _{context->mPropLock}; ALboolean value{AL_FALSE}; @@ -236,7 +236,7 @@ AL_API ALboolean AL_APIENTRY alGetBoolean(ALenum pname) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return AL_FALSE; + if(!context) [[unlikely]] return AL_FALSE; std::lock_guard<std::mutex> _{context->mPropLock}; ALboolean value{AL_FALSE}; @@ -293,7 +293,7 @@ AL_API ALdouble AL_APIENTRY alGetDouble(ALenum pname) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return 0.0; + if(!context) [[unlikely]] return 0.0; std::lock_guard<std::mutex> _{context->mPropLock}; ALdouble value{0.0}; @@ -344,7 +344,7 @@ AL_API ALfloat AL_APIENTRY alGetFloat(ALenum pname) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return 0.0f; + if(!context) [[unlikely]] return 0.0f; std::lock_guard<std::mutex> _{context->mPropLock}; ALfloat value{0.0f}; @@ -395,7 +395,7 @@ AL_API ALint AL_APIENTRY alGetInteger(ALenum pname) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return 0; + if(!context) [[unlikely]] return 0; std::lock_guard<std::mutex> _{context->mPropLock}; ALint value{0}; @@ -481,7 +481,7 @@ AL_API ALint64SOFT AL_APIENTRY alGetInteger64SOFT(ALenum pname) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return 0_i64; + if(!context) [[unlikely]] return 0_i64; std::lock_guard<std::mutex> _{context->mPropLock}; ALint64SOFT value{0}; @@ -532,7 +532,7 @@ AL_API ALvoid* AL_APIENTRY alGetPointerSOFT(ALenum pname) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return nullptr; + if(!context) [[unlikely]] return nullptr; std::lock_guard<std::mutex> _{context->mPropLock}; void *value{nullptr}; @@ -575,7 +575,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!values) context->setError(AL_INVALID_VALUE, "NULL pointer"); @@ -608,7 +608,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!values) context->setError(AL_INVALID_VALUE, "NULL pointer"); @@ -641,7 +641,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!values) context->setError(AL_INVALID_VALUE, "NULL pointer"); @@ -674,7 +674,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!values) context->setError(AL_INVALID_VALUE, "NULL pointer"); @@ -707,7 +707,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!values) context->setError(AL_INVALID_VALUE, "NULL pointer"); @@ -734,7 +734,7 @@ START_API_FUNC } ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!values) context->setError(AL_INVALID_VALUE, "NULL pointer"); @@ -750,7 +750,7 @@ AL_API const ALchar* AL_APIENTRY alGetString(ALenum pname) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return nullptr; + if(!context) [[unlikely]] return nullptr; const ALchar *value{nullptr}; switch(pname) @@ -806,7 +806,7 @@ AL_API void AL_APIENTRY alDopplerFactor(ALfloat value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!(value >= 0.0f && std::isfinite(value))) context->setError(AL_INVALID_VALUE, "Doppler factor %f out of range", value); @@ -823,7 +823,7 @@ AL_API void AL_APIENTRY alDopplerVelocity(ALfloat value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!(value >= 0.0f && std::isfinite(value))) context->setError(AL_INVALID_VALUE, "Doppler velocity %f out of range", value); @@ -840,7 +840,7 @@ AL_API void AL_APIENTRY alSpeedOfSound(ALfloat value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(!(value > 0.0f && std::isfinite(value))) context->setError(AL_INVALID_VALUE, "Speed of sound %f out of range", value); @@ -857,7 +857,7 @@ AL_API void AL_APIENTRY alDistanceModel(ALenum value) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; if(auto model = DistanceModelFromALenum(value)) { @@ -876,7 +876,7 @@ AL_API void AL_APIENTRY alDeferUpdatesSOFT(void) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; context->deferUpdates(); @@ -887,7 +887,7 @@ AL_API void AL_APIENTRY alProcessUpdatesSOFT(void) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return; + if(!context) [[unlikely]] return; std::lock_guard<std::mutex> _{context->mPropLock}; context->processUpdates(); @@ -899,7 +899,7 @@ AL_API const ALchar* AL_APIENTRY alGetStringiSOFT(ALenum pname, ALsizei index) START_API_FUNC { ContextRef context{GetContextRef()}; - if(!context) [[alunlikely]] return nullptr; + if(!context) [[unlikely]] return nullptr; const ALchar *value{nullptr}; switch(pname) diff --git a/alc/alc.cpp b/alc/alc.cpp index 2e474f3e..401a2ab6 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2414,7 +2414,7 @@ ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) bool ResetDeviceParams(ALCdevice *device, const int *attrList) { /* If the device was disconnected, reset it since we're opened anew. */ - if(!device->Connected.load(std::memory_order_relaxed)) [[alunlikely]] + if(!device->Connected.load(std::memory_order_relaxed)) [[unlikely]] { /* Make sure disconnection is finished before continuing on. */ device->waitForMix(); @@ -2446,7 +2446,7 @@ bool ResetDeviceParams(ALCdevice *device, const int *attrList) } ALCenum err{UpdateDeviceParams(device, attrList)}; - if(err == ALC_NO_ERROR) [[allikely]] return ALC_TRUE; + if(err == ALC_NO_ERROR) [[likely]] return ALC_TRUE; alcSetError(device, err); return ALC_FALSE; diff --git a/alc/alu.cpp b/alc/alu.cpp index a50a232e..dc5ed122 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -487,7 +487,7 @@ bool CalcEffectSlotParams(EffectSlot *slot, EffectSlot **sorted_slots, ContextBa /* Otherwise, if it would be deleted send it off with a release event. */ RingBuffer *ring{context->mAsyncEvents.get()}; auto evt_vec = ring->getWriteVector(); - if(evt_vec.first.len > 0) [[allikely]] + if(evt_vec.first.len > 0) [[likely]] { AsyncEvent *evt{al::construct_at(reinterpret_cast<AsyncEvent*>(evt_vec.first.buf), AsyncEvent::ReleaseEffectState)}; @@ -1526,7 +1526,7 @@ void CalcAttnSourceParams(Voice *voice, const VoiceProps *props, const ContextBa } /* Distance-based air absorption and initial send decay. */ - if(Distance > props->RefDistance) [[allikely]] + if(Distance > props->RefDistance) [[likely]] { const float distance_base{(Distance-props->RefDistance) * props->RolloffFactor}; const float distance_meters{distance_base * context->mParams.MetersPerUnit}; @@ -1821,7 +1821,7 @@ void ProcessParamUpdates(ContextBase *ctx, const EffectSlotArray &slots, ProcessVoiceChanges(ctx); IncrementRef(ctx->mUpdateCount); - if(!ctx->mHoldUpdates.load(std::memory_order_acquire)) [[allikely]] + if(!ctx->mHoldUpdates.load(std::memory_order_acquire)) [[likely]] { bool force{CalcContextParams(ctx)}; auto sorted_slots = const_cast<EffectSlot**>(slots.data() + slots.size()); @@ -1913,7 +1913,7 @@ void ProcessContexts(DeviceBase *device, const uint SamplesToDo) * left that don't target any sorted slots, they can't * contribute to the output, so leave them. */ - if(next_target == split_point) [[alunlikely]] + if(next_target == split_point) [[unlikely]] break; --next_target; @@ -1956,7 +1956,7 @@ void ApplyDistanceComp(const al::span<FloatBufferLine> Samples, const size_t Sam float *inout{al::assume_aligned<16>(chanbuffer.data())}; auto inout_end = inout + SamplesToDo; - if(SamplesToDo >= base) [[allikely]] + if(SamplesToDo >= base) [[likely]] { auto delay_end = std::rotate(inout, inout_end - base, inout_end); std::swap_ranges(inout, delay_end, distbuf); @@ -2131,7 +2131,7 @@ void DeviceBase::renderSamples(void *outBuffer, const uint numSamples, const siz { const uint samplesToDo{renderSamples(todo)}; - if(outBuffer) [[allikely]] + if(outBuffer) [[likely]] { /* Finally, interleave and convert samples, writing to the device's * output buffer. diff --git a/alc/backends/jack.cpp b/alc/backends/jack.cpp index afa26b23..cbe1184d 100644 --- a/alc/backends/jack.cpp +++ b/alc/backends/jack.cpp @@ -340,7 +340,7 @@ int JackPlayback::processRt(jack_nframes_t numframes) noexcept out[numchans++] = static_cast<float*>(jack_port_get_buffer(port, numframes)); } - if(mPlaying.load(std::memory_order_acquire)) [[allikely]] + if(mPlaying.load(std::memory_order_acquire)) [[likely]] mDevice->renderSamples({out.data(), numchans}, static_cast<uint>(numframes)); else { @@ -364,7 +364,7 @@ int JackPlayback::process(jack_nframes_t numframes) noexcept } jack_nframes_t total{0}; - if(mPlaying.load(std::memory_order_acquire)) [[allikely]] + if(mPlaying.load(std::memory_order_acquire)) [[likely]] { auto data = mRing->getReadVector(); jack_nframes_t todo{minu(numframes, static_cast<uint>(data.first.len))}; diff --git a/alc/backends/opensl.cpp b/alc/backends/opensl.cpp index 901d2ebe..b3c90880 100644 --- a/alc/backends/opensl.cpp +++ b/alc/backends/opensl.cpp @@ -147,9 +147,9 @@ const char *res_str(SLresult result) noexcept return "Unknown error code"; } -#define PRINTERR(x, s) do { \ - if((x) != SL_RESULT_SUCCESS) [[alunlikely]] \ - ERR("%s: %s\n", (s), res_str((x))); \ +#define PRINTERR(x, s) do { \ + if((x) != SL_RESULT_SUCCESS) [[unlikely]] \ + ERR("%s: %s\n", (s), res_str((x))); \ } while(0) @@ -916,12 +916,12 @@ void OpenSLCapture::captureSamples(al::byte *buffer, uint samples) } SLAndroidSimpleBufferQueueItf bufferQueue{}; - if(mDevice->Connected.load(std::memory_order_acquire)) [[allikely]] + if(mDevice->Connected.load(std::memory_order_acquire)) [[likely]] { const SLresult result{VCALL(mRecordObj,GetInterface)(SL_IID_ANDROIDSIMPLEBUFFERQUEUE, &bufferQueue)}; PRINTERR(result, "recordObj->GetInterface"); - if(SL_RESULT_SUCCESS != result) [[alunlikely]] + if(SL_RESULT_SUCCESS != result) [[unlikely]] { mDevice->handleDisconnect("Failed to get capture buffer queue: 0x%08x", result); bufferQueue = nullptr; @@ -942,7 +942,7 @@ void OpenSLCapture::captureSamples(al::byte *buffer, uint samples) SLresult result{SL_RESULT_SUCCESS}; auto wdata = mRing->getWriteVector(); - if(adv_count > wdata.second.len) [[allikely]] + if(adv_count > wdata.second.len) [[likely]] { auto len1 = std::min(wdata.first.len, adv_count-wdata.second.len); auto buf1 = wdata.first.buf + chunk_size*(wdata.first.len-len1); diff --git a/alc/backends/pipewire.cpp b/alc/backends/pipewire.cpp index 48a1cb10..0539e0c9 100644 --- a/alc/backends/pipewire.cpp +++ b/alc/backends/pipewire.cpp @@ -474,7 +474,7 @@ struct EventManager { */ void waitForInit() { - if(!mInitDone.load(std::memory_order_acquire)) [[alunlikely]] + if(!mInitDone.load(std::memory_order_acquire)) [[unlikely]] { MainloopUniqueLock plock{mLoop}; plock.wait([this](){ return mInitDone.load(std::memory_order_acquire); }); @@ -857,7 +857,7 @@ void NodeProxy::infoCallback(const pw_node_info *info) { /* Can this actually change? */ const char *media_class{spa_dict_lookup(info->props, PW_KEY_MEDIA_CLASS)}; - if(!media_class) [[alunlikely]] return; + if(!media_class) [[unlikely]] return; NodeType ntype{}; if(al::strcasecmp(media_class, AudioSinkClass) == 0) @@ -901,7 +901,7 @@ void NodeProxy::paramCallback(int, uint32_t id, uint32_t, uint32_t, const spa_po if(id == SPA_PARAM_EnumFormat) { DeviceNode *node{DeviceNode::Find(mId)}; - if(!node) [[alunlikely]] return; + if(!node) [[unlikely]] return; if(const spa_pod_prop *prop{spa_pod_find_prop(param, nullptr, SPA_FORMAT_AUDIO_rate)}) node->parseSampleRate(&prop->value); @@ -1326,7 +1326,7 @@ void PipeWirePlayback::ioChangedCallback(uint32_t id, void *area, uint32_t size) void PipeWirePlayback::outputCallback() { pw_buffer *pw_buf{pw_stream_dequeue_buffer(mStream.get())}; - if(!pw_buf) [[alunlikely]] return; + if(!pw_buf) [[unlikely]] return; const al::span<spa_data> datas{pw_buf->buffer->datas, minu(mNumChannels, pw_buf->buffer->n_datas)}; @@ -1342,7 +1342,7 @@ void PipeWirePlayback::outputCallback() uint length{mRateMatch ? mRateMatch->size : 0u}; #endif /* If no length is specified, use the device's update size as a fallback. */ - if(!length) [[alunlikely]] length = mDevice->UpdateSize; + if(!length) [[unlikely]] length = mDevice->UpdateSize; /* For planar formats, each datas[] seems to contain one channel, so store * the pointers in an array. Limit the render length in case the available @@ -1713,7 +1713,7 @@ ClockLatency PipeWirePlayback::getClockLatency() */ nanoseconds monoclock{seconds{tspec.tv_sec} + nanoseconds{tspec.tv_nsec}}; nanoseconds curtic{}, delay{}; - if(ptime.rate.denom < 1) [[alunlikely]] + if(ptime.rate.denom < 1) [[unlikely]] { /* If there's no stream rate, the stream hasn't had a chance to get * going and return time info yet. Just use dummy values. @@ -1811,7 +1811,7 @@ void PipeWireCapture::stateChangedCallback(pw_stream_state, pw_stream_state, con void PipeWireCapture::inputCallback() { pw_buffer *pw_buf{pw_stream_dequeue_buffer(mStream.get())}; - if(!pw_buf) [[alunlikely]] return; + if(!pw_buf) [[unlikely]] return; spa_data *bufdata{pw_buf->buffer->datas}; const uint offset{minu(bufdata->chunk->offset, bufdata->maxsize)}; diff --git a/alc/backends/pulseaudio.cpp b/alc/backends/pulseaudio.cpp index 7f8a8fb3..0e9bf268 100644 --- a/alc/backends/pulseaudio.cpp +++ b/alc/backends/pulseaudio.cpp @@ -688,7 +688,7 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexce pa_free_cb_t free_func{nullptr}; auto buflen = static_cast<size_t>(-1); void *buf{}; - if(pa_stream_begin_write(stream, &buf, &buflen) || !buf) [[alunlikely]] + if(pa_stream_begin_write(stream, &buf, &buflen) || !buf) [[unlikely]] { buflen = nbytes; buf = pa_xmalloc(buflen); @@ -701,7 +701,7 @@ void PulsePlayback::streamWriteCallback(pa_stream *stream, size_t nbytes) noexce mDevice->renderSamples(buf, static_cast<uint>(buflen/mFrameSize), mSpec.channels); int ret{pa_stream_write(stream, buf, buflen, free_func, 0, PA_SEEK_RELATIVE)}; - if(ret != PA_OK) [[alunlikely]] + if(ret != PA_OK) [[unlikely]] ERR("Failed to write to stream: %d, %s\n", ret, pa_strerror(ret)); } while(nbytes > 0); } @@ -1046,7 +1046,7 @@ ClockLatency PulsePlayback::getClockLatency() err = pa_stream_get_latency(mStream, &latency, &neg); } - if(err != 0) [[alunlikely]] + if(err != 0) [[unlikely]] { /* If err = -PA_ERR_NODATA, it means we were called too soon after * starting the stream and no timing info has been received from the @@ -1057,7 +1057,7 @@ ClockLatency PulsePlayback::getClockLatency() latency = mDevice->BufferSize - mDevice->UpdateSize; neg = 0; } - else if(neg) [[alunlikely]] + else if(neg) [[unlikely]] latency = 0; ret.Latency = std::chrono::microseconds{latency}; @@ -1284,7 +1284,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples) if(!mCapBuffer.empty()) { const size_t rem{minz(dstbuf.size(), mCapBuffer.size())}; - if(mCapLen < 0) [[alunlikely]] + if(mCapLen < 0) [[unlikely]] std::fill_n(dstbuf.begin(), rem, mSilentVal); else std::copy_n(mCapBuffer.begin(), rem, dstbuf.begin()); @@ -1294,7 +1294,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples) continue; } - if(!mDevice->Connected.load(std::memory_order_acquire)) [[alunlikely]] + if(!mDevice->Connected.load(std::memory_order_acquire)) [[unlikely]] break; MainloopUniqueLock plock{mMainloop}; @@ -1305,14 +1305,14 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples) mCapLen = 0; } const pa_stream_state_t state{pa_stream_get_state(mStream)}; - if(!PA_STREAM_IS_GOOD(state)) [[alunlikely]] + if(!PA_STREAM_IS_GOOD(state)) [[unlikely]] { mDevice->handleDisconnect("Bad capture state: %u", state); break; } const void *capbuf; size_t caplen; - if(pa_stream_peek(mStream, &capbuf, &caplen) < 0) [[alunlikely]] + if(pa_stream_peek(mStream, &capbuf, &caplen) < 0) [[unlikely]] { mDevice->handleDisconnect("Failed retrieving capture samples: %s", pa_strerror(pa_context_errno(mContext))); @@ -1321,7 +1321,7 @@ void PulseCapture::captureSamples(al::byte *buffer, uint samples) plock.unlock(); if(caplen == 0) break; - if(!capbuf) [[alunlikely]] + if(!capbuf) [[unlikely]] mCapLen = -static_cast<ssize_t>(caplen); else mCapLen = static_cast<ssize_t>(caplen); @@ -1339,7 +1339,7 @@ uint PulseCapture::availableSamples() { MainloopUniqueLock plock{mMainloop}; size_t got{pa_stream_readable_size(mStream)}; - if(static_cast<ssize_t>(got) < 0) [[alunlikely]] + if(static_cast<ssize_t>(got) < 0) [[unlikely]] { const char *err{pa_strerror(static_cast<int>(got))}; ERR("pa_stream_readable_size() failed: %s\n", err); @@ -1370,13 +1370,13 @@ ClockLatency PulseCapture::getClockLatency() err = pa_stream_get_latency(mStream, &latency, &neg); } - if(err != 0) [[alunlikely]] + if(err != 0) [[unlikely]] { ERR("Failed to get stream latency: 0x%x\n", err); latency = 0; neg = 0; } - else if(neg) [[alunlikely]] + else if(neg) [[unlikely]] latency = 0; ret.Latency = std::chrono::microseconds{latency}; diff --git a/alc/effects/reverb.cpp b/alc/effects/reverb.cpp index 3464628c..4af9e2a8 100644 --- a/alc/effects/reverb.cpp +++ b/alc/effects/reverb.cpp @@ -1752,7 +1752,7 @@ void ReverbState::process(const size_t samplesToDo, const al::span<const FloatBu } /* Process reverb for these samples. */ - if(!mDoFading) [[allikely]] + if(!mDoFading) [[likely]] { /* Generate non-faded early reflections and late reverb. */ earlyUnfaded(offset, samplesToDo); diff --git a/common/alcomplex.cpp b/common/alcomplex.cpp index cce92665..a31df79c 100644 --- a/common/alcomplex.cpp +++ b/common/alcomplex.cpp @@ -101,7 +101,7 @@ complex_fft(const al::span<std::complex<Real>> buffer, const Real sign) */ const size_t log2_size{static_cast<size_t>(al::countr_zero(fftsize))}; - if(log2_size >= gBitReverses.size()) [[alunlikely]] + if(log2_size >= gBitReverses.size()) [[unlikely]] { for(size_t idx{1u};idx < fftsize-1;++idx) { @@ -116,7 +116,7 @@ complex_fft(const al::span<std::complex<Real>> buffer, const Real sign) std::swap(buffer[idx], buffer[revidx]); } } - else for(auto &rev : gBitReverses[log2_size]) [[allikely]] + else for(auto &rev : gBitReverses[log2_size]) [[likely]] std::swap(buffer[rev.first], buffer[rev.second]); /* Iterative form of Danielson-Lanczos lemma */ diff --git a/common/alnumeric.h b/common/alnumeric.h index b617b363..13e61645 100644 --- a/common/alnumeric.h +++ b/common/alnumeric.h @@ -161,11 +161,11 @@ inline int float2int(float f) noexcept shift = ((conv.i>>23)&0xff) - (127+23); /* Over/underflow */ - if(shift >= 31 || shift < -23) [[alunlikely]] + if(shift >= 31 || shift < -23) [[unlikely]] return 0; mant = (conv.i&0x7fffff) | 0x800000; - if(shift < 0) [[allikely]] + if(shift < 0) [[likely]] return (mant >> -shift) * sign; return (mant << shift) * sign; @@ -198,11 +198,11 @@ inline int double2int(double d) noexcept shift = ((conv.i64 >> 52) & 0x7ff) - (1023 + 52); /* Over/underflow */ - if(shift >= 63 || shift < -52) [[alunlikely]] + if(shift >= 63 || shift < -52) [[unlikely]] return 0; mant = (conv.i64 & 0xfffffffffffff_i64) | 0x10000000000000_i64; - if(shift < 0) [[allikely]] + if(shift < 0) [[likely]] return (int)(mant >> -shift) * sign; return (int)(mant << shift) * sign; @@ -251,7 +251,7 @@ inline float fast_roundf(float f) noexcept sign = (conv.i>>31)&0x01; expo = (conv.i>>23)&0xff; - if(expo >= 150/*+23*/) [[alunlikely]] + if(expo >= 150/*+23*/) [[unlikely]] { /* An exponent (base-2) of 23 or higher is incapable of sub-integral * precision, so it's already an integral value. We don't need to worry diff --git a/common/comptr.h b/common/comptr.h index 83f339ca..f2355d05 100644 --- a/common/comptr.h +++ b/common/comptr.h @@ -44,7 +44,7 @@ public: } ComPtr& operator=(ComPtr&& rhs) { - if(&rhs != this) [[allikely]] + if(&rhs != this) [[likely]] { if(mPtr) mPtr->Release(); mPtr = std::exchange(rhs.mPtr, nullptr); diff --git a/common/intrusive_ptr.h b/common/intrusive_ptr.h index ba932b95..5e65ba78 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(ref == 0) [[alunlikely]] + if(ref == 0) [[unlikely]] delete static_cast<T*>(this); return ref; } @@ -71,7 +71,7 @@ public: } intrusive_ptr& operator=(intrusive_ptr&& rhs) noexcept { - if(&rhs != this) [[allikely]] + if(&rhs != this) [[likely]] { if(mPtr) mPtr->release(); mPtr = std::exchange(rhs.mPtr, nullptr); diff --git a/common/opthelpers.h b/common/opthelpers.h index 105ca89f..f6d9cc00 100644 --- a/common/opthelpers.h +++ b/common/opthelpers.h @@ -19,14 +19,6 @@ #define force_inline inline #endif -#if __has_attribute(likely) -#define allikely likely -#define alunlikely unlikely -#else -#define allikely -#define alunlikely -#endif - /* Unlike the likely attribute, ASSUME requires the condition to be true or * else it invokes undefined behavior. It's essentially an assert without * actually checking the condition at run-time, allowing for stronger diff --git a/common/polyphase_resampler.cpp b/common/polyphase_resampler.cpp index 76723915..5475cff8 100644 --- a/common/polyphase_resampler.cpp +++ b/common/polyphase_resampler.cpp @@ -21,7 +21,7 @@ using uint = unsigned int; */ double Sinc(const double x) { - if(std::abs(x) < Epsilon) [[alunlikely]] + if(std::abs(x) < Epsilon) [[unlikely]] return 1.0; return std::sin(al::numbers::pi*x) / (al::numbers::pi*x); } @@ -96,7 +96,7 @@ constexpr uint Gcd(uint x, uint y) constexpr uint CalcKaiserOrder(const double rejection, const double transition) { const double w_t{2.0 * al::numbers::pi * transition}; - if(rejection > 21.0) [[allikely]] + if(rejection > 21.0) [[likely]] return static_cast<uint>(std::ceil((rejection - 7.95) / (2.285 * w_t))); return static_cast<uint>(std::ceil(5.79 / w_t)); } @@ -104,7 +104,7 @@ constexpr uint CalcKaiserOrder(const double rejection, const double transition) // Calculates the beta value of the Kaiser window. Rejection is in dB. constexpr double CalcKaiserBeta(const double rejection) { - if(rejection > 50.0) [[allikely]] + if(rejection > 50.0) [[likely]] return 0.1102 * (rejection - 8.7); if(rejection >= 21.0) return (0.5842 * std::pow(rejection - 21.0, 0.4)) + @@ -171,13 +171,13 @@ void PPhaseResampler::init(const uint srcRate, const uint dstRate) // polyphase filter implementation. void PPhaseResampler::process(const uint inN, const double *in, const uint outN, double *out) { - if(outN == 0) [[alunlikely]] + if(outN == 0) [[unlikely]] return; // Handle in-place operation. std::vector<double> workspace; double *work{out}; - if(work == in) [[alunlikely]] + if(work == in) [[unlikely]] { workspace.resize(outN); work = workspace.data(); @@ -195,17 +195,17 @@ void PPhaseResampler::process(const uint inN, const double *in, const uint outN, // Only take input when 0 <= j_s < inN. double r{0.0}; - if(j_f < m) [[allikely]] + if(j_f < m) [[likely]] { size_t filt_len{(m-j_f+p-1) / p}; - if(j_s+1 > inN) [[allikely]] + if(j_s+1 > inN) [[likely]] { size_t skip{std::min<size_t>(j_s+1 - inN, filt_len)}; j_f += p*skip; j_s -= skip; filt_len -= skip; } - if(size_t todo{std::min<size_t>(j_s+1, filt_len)}) [[allikely]] + if(size_t todo{std::min<size_t>(j_s+1, filt_len)}) [[likely]] { do { r += f[j_f] * in[j_s]; diff --git a/core/ambdec.cpp b/core/ambdec.cpp index 8b7467ce..83c521c0 100644 --- a/core/ambdec.cpp +++ b/core/ambdec.cpp @@ -61,7 +61,7 @@ al::optional<std::string> make_error(size_t linenum, const char *fmt, ...) va_start(args, fmt); va_copy(args2, args); const int msglen{std::vsnprintf(&str[plen], str.size()-plen, fmt, args)}; - if(msglen >= 0 && static_cast<size_t>(msglen) >= str.size()-plen) [[alunlikely]] + if(msglen >= 0 && static_cast<size_t>(msglen) >= str.size()-plen) [[unlikely]] { str.resize(static_cast<size_t>(msglen) + plen + 1u); std::vsnprintf(&str[plen], str.size()-plen, fmt, args2); diff --git a/core/bformatdec.cpp b/core/bformatdec.cpp index 5c3f1864..b93c2f44 100644 --- a/core/bformatdec.cpp +++ b/core/bformatdec.cpp @@ -115,7 +115,7 @@ void BFormatDec::processStablize(const al::span<FloatBufferLine> OutBuffer, auto &DelayBuf = mStablizer->DelayBuf[i]; auto buffer_end = OutBuffer[i].begin() + SamplesToDo; - if(SamplesToDo >= FrontStablizer::DelayLength) [[allikely]] + if(SamplesToDo >= FrontStablizer::DelayLength) [[likely]] { auto delay_end = std::rotate(OutBuffer[i].begin(), buffer_end - FrontStablizer::DelayLength, buffer_end); diff --git a/core/converter.cpp b/core/converter.cpp index e0fbaecd..35b1f289 100644 --- a/core/converter.cpp +++ b/core/converter.cpp @@ -143,7 +143,7 @@ void Multi2Mono(uint chanmask, const size_t step, const float scale, float *REST std::fill_n(dst, frames, 0.0f); for(size_t c{0};chanmask;++c) { - if((chanmask&1)) [[allikely]] + if((chanmask&1)) [[likely]] { for(size_t i{0u};i < frames;i++) dst[i] += LoadSample<T>(ssrc[i*step + c]); diff --git a/core/device.h b/core/device.h index a287dd57..6317067e 100644 --- a/core/device.h +++ b/core/device.h @@ -277,7 +277,7 @@ struct DeviceBase { void ProcessBs2b(const size_t SamplesToDo); inline void postProcess(const size_t SamplesToDo) - { if(PostProcess) [[allikely]] (this->*PostProcess)(SamplesToDo); } + { if(PostProcess) [[likely]] (this->*PostProcess)(SamplesToDo); } void renderSamples(const al::span<float*> outBuffers, const uint numSamples); void renderSamples(void *outBuffer, const uint numSamples, const size_t frameStep); diff --git a/core/except.cpp b/core/except.cpp index 5e757ed7..8e3536bd 100644 --- a/core/except.cpp +++ b/core/except.cpp @@ -19,7 +19,7 @@ void base_exception::setMessage(const char* msg, std::va_list args) std::va_list args2; va_copy(args2, args); int msglen{std::vsnprintf(nullptr, 0, msg, args)}; - if(msglen > 0) [[allikely]] + if(msglen > 0) [[likely]] { mMessage.resize(static_cast<size_t>(msglen)+1); std::vsnprintf(&mMessage[0], mMessage.length(), msg, args2); diff --git a/core/logging.cpp b/core/logging.cpp index ec81764c..8efa6a70 100644 --- a/core/logging.cpp +++ b/core/logging.cpp @@ -26,7 +26,7 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...) va_start(args, fmt); va_copy(args2, args); const int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)}; - if(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)) [[alunlikely]] + if(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)) [[unlikely]] { dynmsg.resize(static_cast<size_t>(msglen) + 1u); str = dynmsg.data(); @@ -66,7 +66,7 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...) va_start(args, fmt); va_copy(args2, args); const int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)}; - if(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)) [[alunlikely]] + if(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)) [[unlikely]] { dynmsg.resize(static_cast<size_t>(msglen) + 1u); str = dynmsg.data(); diff --git a/core/logging.h b/core/logging.h index 87f1c0f5..e90de661 100644 --- a/core/logging.h +++ b/core/logging.h @@ -19,17 +19,17 @@ extern FILE *gLogFile; #if !defined(_WIN32) && !defined(__ANDROID__) #define TRACE(...) do { \ - if(gLogLevel >= LogLevel::Trace) [[alunlikely]] \ + if(gLogLevel >= LogLevel::Trace) [[unlikely]] \ fprintf(gLogFile, "[ALSOFT] (II) " __VA_ARGS__); \ } while(0) #define WARN(...) do { \ - if(gLogLevel >= LogLevel::Warning) [[alunlikely]] \ + if(gLogLevel >= LogLevel::Warning) [[unlikely]] \ fprintf(gLogFile, "[ALSOFT] (WW) " __VA_ARGS__); \ } while(0) #define ERR(...) do { \ - if(gLogLevel >= LogLevel::Error) [[alunlikely]] \ + if(gLogLevel >= LogLevel::Error) [[unlikely]] \ fprintf(gLogFile, "[ALSOFT] (EE) " __VA_ARGS__); \ } while(0) diff --git a/core/mastering.cpp b/core/mastering.cpp index 6a085c3a..a4f66fbb 100644 --- a/core/mastering.cpp +++ b/core/mastering.cpp @@ -295,7 +295,7 @@ void SignalDelay(Compressor *Comp, const uint SamplesToDo, FloatBufferLine *OutB float *delaybuf{al::assume_aligned<16>(Comp->mDelay[c].data())}; auto inout_end = inout + SamplesToDo; - if(SamplesToDo >= lookAhead) [[allikely]] + if(SamplesToDo >= lookAhead) [[likely]] { auto delay_end = std::rotate(inout, inout_end - lookAhead, inout_end); std::swap_ranges(inout, delay_end, delaybuf); diff --git a/core/mixer/hrtfbase.h b/core/mixer/hrtfbase.h index c8c78263..656b9445 100644 --- a/core/mixer/hrtfbase.h +++ b/core/mixer/hrtfbase.h @@ -50,7 +50,7 @@ inline void MixHrtfBlendBase(const float *InSamples, float2 *RESTRICT AccumSampl const ConstHrirSpan NewCoeffs{newparams->Coeffs}; const float newGainStep{newparams->GainStep}; - if(oldparams->Gain > GainSilenceThreshold) [[allikely]] + if(oldparams->Gain > GainSilenceThreshold) [[likely]] { size_t ldelay{HrtfHistoryLength - oldparams->Delay[0]}; size_t rdelay{HrtfHistoryLength - oldparams->Delay[1]}; @@ -66,7 +66,7 @@ inline void MixHrtfBlendBase(const float *InSamples, float2 *RESTRICT AccumSampl } } - if(newGainStep*static_cast<float>(BufferSize) > GainSilenceThreshold) [[allikely]] + if(newGainStep*static_cast<float>(BufferSize) > GainSilenceThreshold) [[likely]] { size_t ldelay{HrtfHistoryLength+1 - newparams->Delay[0]}; size_t rdelay{HrtfHistoryLength+1 - newparams->Delay[1]}; diff --git a/core/uhjfilter.cpp b/core/uhjfilter.cpp index 0ee06d06..ac5f2d40 100644 --- a/core/uhjfilter.cpp +++ b/core/uhjfilter.cpp @@ -140,7 +140,7 @@ void UhjEncoder<N>::encode(float *LeftOut, float *RightOut, float *inout{al::assume_aligned<16>(buffer)}; auto inout_end = inout + SamplesToDo; - if(SamplesToDo >= sFilterDelay) [[allikely]] + if(SamplesToDo >= sFilterDelay) [[likely]] { auto delay_end = std::rotate(inout, inout_end - sFilterDelay, inout_end); std::swap_ranges(inout, delay_end, distbuf); diff --git a/core/voice.cpp b/core/voice.cpp index 0b4884a0..be72b691 100644 --- a/core/voice.cpp +++ b/core/voice.cpp @@ -366,7 +366,7 @@ void DoHrtfMix(const float *samples, const uint DstBufferSize, DirectParams &par std::begin(HrtfSamples)); std::copy_n(samples, DstBufferSize, src_iter); /* Copy the last used samples back into the history buffer for later. */ - if(IsPlaying) [[allikely]] + if(IsPlaying) [[likely]] std::copy_n(std::begin(HrtfSamples) + DstBufferSize, parms.Hrtf.History.size(), parms.Hrtf.History.begin()); @@ -473,7 +473,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi VoiceBufferItem *BufferListItem{mCurrentBuffer.load(std::memory_order_relaxed)}; VoiceBufferItem *BufferLoopItem{mLoopBuffer.load(std::memory_order_relaxed)}; const uint increment{mStep}; - if(increment < 1) [[alunlikely]] + if(increment < 1) [[unlikely]] { /* If the voice is supposed to be stopping but can't be mixed, just * stop it before bailing. @@ -536,7 +536,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi } } } - else if(!BufferListItem) [[alunlikely]] + else if(!BufferListItem) [[unlikely]] Counter = std::min(Counter, 64u); std::array<float*,DeviceBase::MixerChannelsMax> SamplePointers; @@ -596,7 +596,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi /* If the voice is stopping, only one mixing iteration will * be done, so ensure it fades out completely this mix. */ - if(vstate == Stopping) [[alunlikely]] + if(vstate == Stopping) [[unlikely]] Counter = std::min(Counter, DstBufferSize); } ASSUME(DstBufferSize > 0); @@ -604,7 +604,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi } float **voiceSamples{}; - if(!BufferListItem) [[alunlikely]] + if(!BufferListItem) [[unlikely]] { const size_t srcOffset{(increment*DstBufferSize + DataPosFrac)>>MixerFracBits}; auto prevSamples = mPrevSamples.data(); @@ -639,7 +639,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi } size_t samplesLoaded{0}; - if(DataPosInt < 0) [[alunlikely]] + if(DataPosInt < 0) [[unlikely]] { if(static_cast<uint>(-DataPosInt) >= SrcBufferSize) goto skip_mix; @@ -688,7 +688,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi } /* Store the last source samples used for next time. */ - if(vstate == Playing) [[allikely]] + if(vstate == Playing) [[likely]] { prevSamples = mPrevSamples.data(); for(auto *chanbuffer : MixingSamples) @@ -755,7 +755,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi } skip_mix: /* If the voice is stopping, we're now done. */ - if(vstate == Stopping) [[alunlikely]] + if(vstate == Stopping) [[unlikely]] break; /* Update positions */ @@ -770,7 +770,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi /* Do nothing extra when there's no buffers, or if the voice position * is still negative. */ - if(!BufferListItem || DataPosInt < 0) [[alunlikely]] + if(!BufferListItem || DataPosInt < 0) [[unlikely]] continue; if(mFlags.test(VoiceIsStatic)) @@ -834,7 +834,7 @@ void Voice::mix(const State vstate, ContextBase *Context, const nanoseconds devi mFlags.set(VoiceIsFading); /* Don't update positions and buffers if we were stopping. */ - if(vstate == Stopping) [[alunlikely]] + if(vstate == Stopping) [[unlikely]] { mPlayState.store(Stopped, std::memory_order_release); return; @@ -888,7 +888,7 @@ void Voice::prepare(DeviceBase *device) */ uint num_channels{(mFmtChannels == FmtUHJ2 || mFmtChannels == FmtSuperStereo) ? 3 : ChannelsFromFmt(mFmtChannels, minu(mAmbiOrder, device->mAmbiOrder))}; - if(num_channels > device->mSampleData.size()) [[alunlikely]] + if(num_channels > device->mSampleData.size()) [[unlikely]] { ERR("Unexpected channel count: %u (limit: %zu, %d:%d)\n", num_channels, device->mSampleData.size(), mFmtChannels, mAmbiOrder); |