Replace BitUtils with C++20: Counting Zeroes

With the upgrade to C++20, std::countl_zero and std::countr_zero can replace these home-spun implementations from the BitUtil.h library.
This commit is contained in:
Minty-Meeo
2022-10-10 04:03:15 -05:00
parent d853da3b0b
commit 05bebee802
8 changed files with 15 additions and 119 deletions

View File

@ -4,10 +4,10 @@
#include "VideoBackends/Metal/MTLStateTracker.h"
#include <algorithm>
#include <bit>
#include <mutex>
#include "Common/Assert.h"
#include "Common/BitUtils.h"
#include "VideoBackends/Metal/MTLObjectCache.h"
#include "VideoBackends/Metal/MTLPerfQuery.h"
@ -713,8 +713,8 @@ static constexpr NSString* LABEL_UTIL = @"Utility Draw";
static NSRange RangeOfBits(u32 value)
{
ASSERT(value && "Value must be nonzero");
u32 low = Common::CountTrailingZeros(value);
u32 high = 31 - Common::CountLeadingZeros(value);
int low = std::countr_zero(value);
int high = 31 - std::countl_zero(value);
return NSMakeRange(low, high + 1 - low);
}