diff options
author | Chris Robinson <[email protected]> | 2020-10-13 01:21:44 -0700 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2020-10-13 01:21:44 -0700 |
commit | 303ca3af72aa7aecc25d94690f3886085c5c6e5b (patch) | |
tree | 05c0a6626b7884a76d181c8972d04f69800c2ece /alc/alc.cpp | |
parent | 45ff10fb4d847662ec7d1048f7e740c0ca55cf27 (diff) |
Use inline functions for popcnt and ctz instead of macros
Diffstat (limited to 'alc/alc.cpp')
-rw-r--r-- | alc/alc.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/alc/alc.cpp b/alc/alc.cpp index 2b43ebf5..1170800d 100644 --- a/alc/alc.cpp +++ b/alc/alc.cpp @@ -2117,7 +2117,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) uint64_t usemask{~sublist.FreeMask}; while(usemask) { - ALsizei idx{CTZ64(usemask)}; + const ALsizei idx{CountTrailingZeros(usemask)}; ALeffectslot *slot{sublist.EffectSlots + idx}; usemask &= ~(1_u64 << idx); @@ -2140,7 +2140,7 @@ static ALCenum UpdateDeviceParams(ALCdevice *device, const int *attrList) uint64_t usemask{~sublist.FreeMask}; while(usemask) { - ALsizei idx{CTZ64(usemask)}; + const ALsizei idx{CountTrailingZeros(usemask)}; ALsource *source{sublist.Sources + idx}; usemask &= ~(1_u64 << idx); @@ -2282,22 +2282,19 @@ ALCdevice::~ALCdevice() size_t count{std::accumulate(BufferList.cbegin(), BufferList.cend(), size_t{0u}, [](size_t cur, const BufferSubList &sublist) noexcept -> size_t - { return cur + static_cast<ALuint>(POPCNT64(~sublist.FreeMask)); } - )}; + { return cur + static_cast<ALuint>(PopCount(~sublist.FreeMask)); })}; if(count > 0) WARN("%zu Buffer%s not deleted\n", count, (count==1)?"":"s"); count = std::accumulate(EffectList.cbegin(), EffectList.cend(), size_t{0u}, [](size_t cur, const EffectSubList &sublist) noexcept -> size_t - { return cur + static_cast<ALuint>(POPCNT64(~sublist.FreeMask)); } - ); + { return cur + static_cast<ALuint>(PopCount(~sublist.FreeMask)); }); if(count > 0) WARN("%zu Effect%s not deleted\n", count, (count==1)?"":"s"); count = std::accumulate(FilterList.cbegin(), FilterList.cend(), size_t{0u}, [](size_t cur, const FilterSubList &sublist) noexcept -> size_t - { return cur + static_cast<ALuint>(POPCNT64(~sublist.FreeMask)); } - ); + { return cur + static_cast<ALuint>(PopCount(~sublist.FreeMask)); }); if(count > 0) WARN("%zu Filter%s not deleted\n", count, (count==1)?"":"s"); @@ -2350,8 +2347,7 @@ ALCcontext::~ALCcontext() count = std::accumulate(mSourceList.cbegin(), mSourceList.cend(), size_t{0u}, [](size_t cur, const SourceSubList &sublist) noexcept -> size_t - { return cur + static_cast<ALuint>(POPCNT64(~sublist.FreeMask)); } - ); + { return cur + static_cast<ALuint>(PopCount(~sublist.FreeMask)); }); if(count > 0) WARN("%zu Source%s not deleted\n", count, (count==1)?"":"s"); mSourceList.clear(); @@ -2377,8 +2373,7 @@ ALCcontext::~ALCcontext() count = std::accumulate(mEffectSlotList.cbegin(), mEffectSlotList.cend(), size_t{0u}, [](size_t cur, const EffectSlotSubList &sublist) noexcept -> size_t - { return cur + static_cast<ALuint>(POPCNT64(~sublist.FreeMask)); } - ); + { return cur + static_cast<ALuint>(PopCount(~sublist.FreeMask)); }); if(count > 0) WARN("%zu AuxiliaryEffectSlot%s not deleted\n", count, (count==1)?"":"s"); mEffectSlotList.clear(); |