From dc0b3288be3a773ba1bcac0920fb73f2d49d6841 Mon Sep 17 00:00:00 2001 From: David Reid Date: Sat, 28 Nov 2020 11:11:15 +1000 Subject: [PATCH] Remove some unnecessary volatile qualifiers. --- research/miniaudio_engine.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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) {