diff options
| author | JosJuice <josjuice@gmail.com> | 2021-07-06 15:57:03 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2021-07-10 20:31:28 +0200 |
| commit | 10861ed8ce4f60f76ec3508f18c02083dfd226e4 (patch) | |
| tree | 3239296e436ff48a62a9cac1d464b9248fd5838f /Source/Core/Common/BitUtils.h | |
| parent | ab024b218e956f478c91c994628ec7153bfe79cf (diff) | |
JitArm64: Turn IsImmLogical into a constexpr constructor
Diffstat (limited to 'Source/Core/Common/BitUtils.h')
| -rw-r--r-- | Source/Core/Common/BitUtils.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/Source/Core/Common/BitUtils.h b/Source/Core/Common/BitUtils.h index d4d23d63d8..09ab4bd78c 100644 --- a/Source/Core/Common/BitUtils.h +++ b/Source/Core/Common/BitUtils.h @@ -413,4 +413,13 @@ constexpr int CountLeadingZeros(uint32_t value) #undef CONSTEXPR_FROM_INTRINSIC +template <typename T> +constexpr T LargestPowerOf2Divisor(T value) +{ + static_assert(std::is_unsigned<T>(), + "LargestPowerOf2Divisor only makes sense for unsigned types."); + + return value & -static_cast<std::make_signed_t<T>>(value); +} + } // namespace Common |
