diff options
author | Rodrigo Locatti <reinuseslisp@airmail.cc> | 2021-01-15 08:48:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-15 08:48:58 +0100 |
commit | 5b9aedfc215e2f7227a8604d2d28fb462949d537 (patch) | |
tree | ed1f105b1fef3fc9a5209c5106accaaee283ebf2 /src/common | |
parent | Merge pull request #5354 from ReinUsesLisp/remove-common-color (diff) | |
parent | common/bit_util: Replace CLZ/CTZ operations with standardized ones (diff) | |
download | yuzu-5b9aedfc215e2f7227a8604d2d28fb462949d537.tar yuzu-5b9aedfc215e2f7227a8604d2d28fb462949d537.tar.gz yuzu-5b9aedfc215e2f7227a8604d2d28fb462949d537.tar.bz2 yuzu-5b9aedfc215e2f7227a8604d2d28fb462949d537.tar.lz yuzu-5b9aedfc215e2f7227a8604d2d28fb462949d537.tar.xz yuzu-5b9aedfc215e2f7227a8604d2d28fb462949d537.tar.zst yuzu-5b9aedfc215e2f7227a8604d2d28fb462949d537.zip |
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/bit_util.h | 76 |
1 files changed, 0 insertions, 76 deletions
diff --git a/src/common/bit_util.h b/src/common/bit_util.h index 29f59a9a3..685e7fc9b 100644 --- a/src/common/bit_util.h +++ b/src/common/bit_util.h @@ -22,82 +22,6 @@ template <typename T> } #ifdef _MSC_VER -[[nodiscard]] inline u32 CountLeadingZeroes32(u32 value) { - unsigned long leading_zero = 0; - - if (_BitScanReverse(&leading_zero, value) != 0) { - return 31 - leading_zero; - } - - return 32; -} - -[[nodiscard]] inline u32 CountLeadingZeroes64(u64 value) { - unsigned long leading_zero = 0; - - if (_BitScanReverse64(&leading_zero, value) != 0) { - return 63 - leading_zero; - } - - return 64; -} -#else -[[nodiscard]] inline u32 CountLeadingZeroes32(u32 value) { - if (value == 0) { - return 32; - } - - return static_cast<u32>(__builtin_clz(value)); -} - -[[nodiscard]] inline u32 CountLeadingZeroes64(u64 value) { - if (value == 0) { - return 64; - } - - return static_cast<u32>(__builtin_clzll(value)); -} -#endif - -#ifdef _MSC_VER -[[nodiscard]] inline u32 CountTrailingZeroes32(u32 value) { - unsigned long trailing_zero = 0; - - if (_BitScanForward(&trailing_zero, value) != 0) { - return trailing_zero; - } - - return 32; -} - -[[nodiscard]] inline u32 CountTrailingZeroes64(u64 value) { - unsigned long trailing_zero = 0; - - if (_BitScanForward64(&trailing_zero, value) != 0) { - return trailing_zero; - } - - return 64; -} -#else -[[nodiscard]] inline u32 CountTrailingZeroes32(u32 value) { - if (value == 0) { - return 32; - } - - return static_cast<u32>(__builtin_ctz(value)); -} - -[[nodiscard]] inline u32 CountTrailingZeroes64(u64 value) { - if (value == 0) { - return 64; - } - - return static_cast<u32>(__builtin_ctzll(value)); -} -#endif - -#ifdef _MSC_VER [[nodiscard]] inline u32 MostSignificantBit32(const u32 value) { unsigned long result; |