Commit dc0b3288 authored by David Reid's avatar David Reid

Remove some unnecessary volatile qualifiers.

parent e10c34bc
...@@ -3828,11 +3828,11 @@ MA_API ma_result ma_slot_allocator_alloc(ma_slot_allocator* pAllocator, ma_uint6 ...@@ -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) { for (iGroup = 0; iGroup < ma_countof(pAllocator->groups); iGroup += 1) {
/* CAS */ /* CAS */
for (;;) { 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 newBitfield;
ma_uint32 bitOffset; 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. */ /* Fast check to see if anything is available. */
if (oldBitfield == 0xFFFFFFFF) { if (oldBitfield == 0xFFFFFFFF) {
...@@ -3896,10 +3896,10 @@ MA_API ma_result ma_slot_allocator_free(ma_slot_allocator* pAllocator, ma_uint64 ...@@ -3896,10 +3896,10 @@ MA_API ma_result ma_slot_allocator_free(ma_slot_allocator* pAllocator, ma_uint64
while (pAllocator->count > 0) { while (pAllocator->count > 0) {
/* CAS */ /* 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; 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); newBitfield = oldBitfield & ~(1 << iBit);
if (c89atomic_compare_and_swap_32(&pAllocator->groups[iGroup].bitfield, oldBitfield, newBitfield) == oldBitfield) { if (c89atomic_compare_and_swap_32(&pAllocator->groups[iGroup].bitfield, oldBitfield, newBitfield) == oldBitfield) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment