diff options
author | Chris Robinson <[email protected]> | 2021-01-22 04:58:42 -0800 |
---|---|---|
committer | Chris Robinson <[email protected]> | 2021-01-22 04:58:42 -0800 |
commit | da59ad51057ce7343e3db4632e8679e1e537779d (patch) | |
tree | 6b4c1f5bd5d6b4bd4b83b9bc290e63ca837f8bc0 /al/buffer.cpp | |
parent | 5ff5fd8eccbdc5888b350059cb1f341a33ddf05f (diff) |
Make PopCount and CountTrailingZeros more standard-like
Diffstat (limited to 'al/buffer.cpp')
-rw-r--r-- | al/buffer.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/al/buffer.cpp b/al/buffer.cpp index cdbedf70..14fae1ee 100644 --- a/al/buffer.cpp +++ b/al/buffer.cpp @@ -41,6 +41,7 @@ #include "AL/alc.h" #include "AL/alext.h" +#include "albit.h" #include "albyte.h" #include "alcmain.h" #include "alcontext.h" @@ -326,7 +327,7 @@ bool EnsureBuffers(ALCdevice *device, size_t needed) { size_t count{std::accumulate(device->BufferList.cbegin(), device->BufferList.cend(), size_t{0}, [](size_t cur, const BufferSubList &sublist) noexcept -> size_t - { return cur + static_cast<ALuint>(PopCount(sublist.FreeMask)); })}; + { return cur + static_cast<ALuint>(al::popcount(sublist.FreeMask)); })}; while(needed > count) { @@ -355,7 +356,7 @@ ALbuffer *AllocBuffer(ALCdevice *device) ); auto lidx = static_cast<ALuint>(std::distance(device->BufferList.begin(), sublist)); - auto slidx = static_cast<ALuint>(CountTrailingZeros(sublist->FreeMask)); + auto slidx = static_cast<ALuint>(al::countr_zero(sublist->FreeMask)); ALbuffer *buffer{::new (sublist->Buffers + slidx) ALbuffer{}}; @@ -1621,7 +1622,7 @@ BufferSubList::~BufferSubList() uint64_t usemask{~FreeMask}; while(usemask) { - const ALsizei idx{CountTrailingZeros(usemask)}; + const int idx{al::countr_zero(usemask)}; al::destroy_at(Buffers+idx); usemask &= ~(1_u64 << idx); } |