mirror of
https://github.com/mackron/miniaudio.git
synced 2026-04-23 08:44:04 +02:00
Remove some unnecessary volatile qualifiers.
This commit is contained in:
@@ -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
|
|||||||
|
|
||||||
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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user