From 303ca3af72aa7aecc25d94690f3886085c5c6e5b Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Tue, 13 Oct 2020 01:21:44 -0700 Subject: Use inline functions for popcnt and ctz instead of macros --- al/source.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'al/source.cpp') diff --git a/al/source.cpp b/al/source.cpp index 9771fec7..c16b77e6 100644 --- a/al/source.cpp +++ b/al/source.cpp @@ -683,8 +683,7 @@ bool EnsureSources(ALCcontext *context, size_t needed) size_t count{std::accumulate(context->mSourceList.cbegin(), context->mSourceList.cend(), size_t{0}, [](size_t cur, const SourceSubList &sublist) noexcept -> size_t - { return cur + static_cast(POPCNT64(sublist.FreeMask)); } - )}; + { return cur + static_cast(PopCount(sublist.FreeMask)); })}; while(needed > count) { @@ -712,7 +711,7 @@ ALsource *AllocSource(ALCcontext *context) { return entry.FreeMask != 0; } ); auto lidx = static_cast(std::distance(context->mSourceList.begin(), sublist)); - auto slidx = static_cast(CTZ64(sublist->FreeMask)); + auto slidx = static_cast(CountTrailingZeros(sublist->FreeMask)); ALsource *source{::new(sublist->Sources + slidx) ALsource{}}; @@ -3410,7 +3409,7 @@ SourceSubList::~SourceSubList() uint64_t usemask{~FreeMask}; while(usemask) { - ALsizei idx{CTZ64(usemask)}; + const ALsizei idx{CountTrailingZeros(usemask)}; al::destroy_at(Sources+idx); usemask &= ~(1_u64 << idx); } -- cgit v1.2.3