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,12 +4,12 @@
#pragma once
#include <algorithm>
#include <bit>
#include <cmath>
#include <limits>
#include <type_traits>
#include <vector>
#include "Common/BitUtils.h"
#include "Common/CommonTypes.h"
namespace MathUtil
@ -193,5 +193,5 @@ float MathFloatVectorSum(const std::vector<float>&);
// Rounds down. 0 -> undefined
constexpr int IntLog2(u64 val)
{
return 63 - Common::CountLeadingZeros(val);
return 63 - std::countl_zero(val);
}