aboutsummaryrefslogtreecommitdiffstats
path: root/al/source.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-01-22 04:58:42 -0800
committerChris Robinson <[email protected]>2021-01-22 04:58:42 -0800
commitda59ad51057ce7343e3db4632e8679e1e537779d (patch)
tree6b4c1f5bd5d6b4bd4b83b9bc290e63ca837f8bc0 /al/source.cpp
parent5ff5fd8eccbdc5888b350059cb1f341a33ddf05f (diff)
Make PopCount and CountTrailingZeros more standard-like
Diffstat (limited to 'al/source.cpp')
-rw-r--r--al/source.cpp7
1 files changed, 4 insertions, 3 deletions
diff --git a/al/source.cpp b/al/source.cpp
index 770e3778..a4e59e59 100644
--- a/al/source.cpp
+++ b/al/source.cpp
@@ -45,6 +45,7 @@
#include "AL/alext.h"
#include "AL/efx.h"
+#include "albit.h"
#include "alcmain.h"
#include "alcontext.h"
#include "almalloc.h"
@@ -684,7 +685,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<ALuint>(PopCount(sublist.FreeMask)); })};
+ { return cur + static_cast<ALuint>(al::popcount(sublist.FreeMask)); })};
while(needed > count)
{
@@ -712,7 +713,7 @@ ALsource *AllocSource(ALCcontext *context)
{ return entry.FreeMask != 0; }
);
auto lidx = static_cast<ALuint>(std::distance(context->mSourceList.begin(), sublist));
- auto slidx = static_cast<ALuint>(CountTrailingZeros(sublist->FreeMask));
+ auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask));
ALsource *source{::new(sublist->Sources + slidx) ALsource{}};
@@ -3484,7 +3485,7 @@ SourceSubList::~SourceSubList()
uint64_t usemask{~FreeMask};
while(usemask)
{
- const ALsizei idx{CountTrailingZeros(usemask)};
+ const int idx{al::countr_zero(usemask)};
al::destroy_at(Sources+idx);
usemask &= ~(1_u64 << idx);
}