diff options
author | Chris Robinson <[email protected]> | 2023-12-20 21:30:24 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2023-12-20 21:30:24 -0800 |
commit | 959fac15dda2c8522265e092f2826e2514102587 (patch) | |
tree | 42b2c5e5729bfd827dd031299ef5e46e485d3269 /alc/alu.cpp | |
parent | 71523810a10d70c07c1009254613466405d2bee1 (diff) |
Use proper iterators for sorting effect slots where possible
Diffstat (limited to 'alc/alu.cpp')
-rw-r--r-- | alc/alu.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/alc/alu.cpp b/alc/alu.cpp index 1990aeeb..1a740d6f 100644 --- a/alc/alu.cpp +++ b/alc/alu.cpp @@ -1967,16 +1967,13 @@ void ProcessContexts(DeviceBase *device, const uint SamplesToDo) } /* Process effects. */ - if(const size_t num_slots{auxslots.size()}) + if(!auxslots.empty()) { - auto slots = auxslots.data(); - auto slots_end = slots + num_slots; - /* Sort the slots into extra storage, so that effect slots come * before their effect slot target (or their targets' target). */ - const al::span<EffectSlot*> sorted_slots{const_cast<EffectSlot**>(slots_end), - num_slots}; + const al::span sorted_slots{const_cast<EffectSlot**>(al::to_address(auxslots.end())), + auxslots.size()}; /* Skip sorting if it has already been done. */ if(!sorted_slots[0]) { @@ -1984,7 +1981,7 @@ void ProcessContexts(DeviceBase *device, const uint SamplesToDo) * sorted list so that all slots without a target slot go to * the end. */ - std::copy(slots, slots_end, sorted_slots.begin()); + std::copy(auxslots.begin(), auxslots.end(), sorted_slots.begin()); auto split_point = std::partition(sorted_slots.begin(), sorted_slots.end(), [](const EffectSlot *slot) noexcept -> bool { return slot->Target != nullptr; }); |