diff --git a/research/miniaudio_engine.h b/research/miniaudio_engine.h index 803aa18d..8cf67d01 100644 --- a/research/miniaudio_engine.h +++ b/research/miniaudio_engine.h @@ -3828,11 +3828,11 @@ MA_API ma_result ma_slot_allocator_alloc(ma_slot_allocator* pAllocator, ma_uint6 for (iGroup = 0; iGroup < ma_countof(pAllocator->groups); iGroup += 1) { /* CAS */ for (;;) { - volatile ma_uint32 oldBitfield; /* Making this volatile because we want to make sure the compiler does not optimize away the oldBitfield assignment. */ + ma_uint32 oldBitfield; ma_uint32 newBitfield; ma_uint32 bitOffset; - oldBitfield = pAllocator->groups[iGroup].bitfield; /* <-- This copy must happen. The compiler must not optimize this away. */ + oldBitfield = pAllocator->groups[iGroup].bitfield; /* <-- This copy must happen. The compiler must not optimize this away. pAllocator->groups[iGroup].bitfield is marked as volatile. */ /* Fast check to see if anything is available. */ if (oldBitfield == 0xFFFFFFFF) { @@ -3896,10 +3896,10 @@ MA_API ma_result ma_slot_allocator_free(ma_slot_allocator* pAllocator, ma_uint64 while (pAllocator->count > 0) { /* CAS */ - volatile ma_uint32 oldBitfield; /* Making this volatile because we want to make sure the compiler does not optimize away the oldBitfield assignment. */ + ma_uint32 oldBitfield; ma_uint32 newBitfield; - oldBitfield = pAllocator->groups[iGroup].bitfield; /* <-- This copy must happen. The compiler must not optimize this away. */ + oldBitfield = pAllocator->groups[iGroup].bitfield; /* <-- This copy must happen. The compiler must not optimize this away. pAllocator->groups[iGroup].bitfield is marked as volatile. */ newBitfield = oldBitfield & ~(1 << iBit); if (c89atomic_compare_and_swap_32(&pAllocator->groups[iGroup].bitfield, oldBitfield, newBitfield) == oldBitfield) {