Use a uint for a bitfield

This commit is contained in:
Chris Robinson 2020-12-27 01:05:16 -08:00
parent e20143fcc4
commit cd2ebb9c3a
3 changed files with 7 additions and 7 deletions

View File

@ -63,7 +63,7 @@ static int EventThread(ALCcontext *context)
continue;
}
ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_acquire)};
uint enabledevts{context->mEnabledEvts.load(std::memory_order_acquire)};
if(!context->mEventCb) continue;
if(evt.EnumType == EventType_SourceStateChange)
@ -164,7 +164,7 @@ START_API_FUNC
if(count <= 0) return;
if(!types) SETERR_RETURN(context, AL_INVALID_VALUE,, "NULL pointer");
ALbitfieldSOFT flags{0};
uint flags{0};
const ALenum *types_end = types+count;
auto bad_type = std::find_if_not(types, types_end,
[&flags](ALenum type) noexcept -> bool
@ -185,7 +185,7 @@ START_API_FUNC
if(enable)
{
ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)};
uint enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)};
while(context->mEnabledEvts.compare_exchange_weak(enabledevts, enabledevts|flags,
std::memory_order_acq_rel, std::memory_order_acquire) == 0)
{
@ -196,7 +196,7 @@ START_API_FUNC
}
else
{
ALbitfieldSOFT enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)};
uint enabledevts{context->mEnabledEvts.load(std::memory_order_relaxed)};
while(context->mEnabledEvts.compare_exchange_weak(enabledevts, enabledevts&~flags,
std::memory_order_acq_rel, std::memory_order_acquire) == 0)
{

View File

@ -216,7 +216,7 @@ struct ALCcontext : public al::intrusive_ref<ALCcontext> {
std::thread mEventThread;
al::semaphore mEventSem;
std::unique_ptr<RingBuffer> mAsyncEvents;
std::atomic<ALbitfieldSOFT> mEnabledEvts{0u};
std::atomic<uint> mEnabledEvts{0u};
std::mutex mEventCbLock;
ALEVENTPROCSOFT mEventCb{};
void *mEventParam{nullptr};

View File

@ -1583,7 +1583,7 @@ void ProcessVoiceChanges(ALCcontext *ctx)
VoiceChange *next{cur->mNext.load(std::memory_order_acquire)};
if(!next) return;
const ALbitfieldSOFT enabledevt{ctx->mEnabledEvts.load(std::memory_order_acquire)};
const uint enabledevt{ctx->mEnabledEvts.load(std::memory_order_acquire)};
do {
cur = next;
@ -1990,7 +1990,7 @@ void ALCdevice::handleDisconnect(const char *msg, ...)
IncrementRef(MixCount);
for(ALCcontext *ctx : *mContexts.load())
{
const ALbitfieldSOFT enabledevt{ctx->mEnabledEvts.load(std::memory_order_acquire)};
const uint enabledevt{ctx->mEnabledEvts.load(std::memory_order_acquire)};
if((enabledevt&EventType_Disconnected))
{
RingBuffer *ring{ctx->mAsyncEvents.get()};