Commit graph

13 commits

Author SHA1 Message Date
Wunkolo
fbf00e7fbc bit_util: Add bit utility function
Extracts a singular bit, as a bool, from the specified compile-time index.
2022-03-09 13:57:47 -08:00
Morph
9ec57a502c common: bit_util: Add IsPow2 helper function
Makes use of std::has_single_bit() to check whether the value is a power of 2.
2022-01-11 16:01:12 -05:00
Fernando Sahmkow
e6d7d48d78 TextureCache: Refactor and fix linux compiling. 2021-11-20 14:46:19 +01:00
bunnei
16a6a7f9d9 common: Add missing include to bit_util.h 2021-01-21 15:30:28 -08:00
Lioncash
1b0b7e4873 bit_util: Unify implementations of MostSignificantBit32/MostSignificantBit64
We can use the standardized CLZ facilities to perform this. This also
allows us to make utilizing functions constexpr and eliminate the
inclusion of an intrinsics header.
2021-01-21 04:07:58 -05:00
Lioncash
d5bff783bd common/bit_util: Replace CLZ/CTZ operations with standardized ones
Makes for less code that we need to maintain.
2021-01-15 02:15:32 -05:00
Lioncash
2ef7815422 common: Make use of [[nodiscard]] where applicable
Now that clang-format makes [[nodiscard]] attributes format sensibly, we
can apply them to several functions within the common library to allow
the compiler to complain about any misuses of the functions.
2020-08-15 17:17:52 -04:00
Fernando Sahmkow
70071a17df texture_cache: Optimize GetMipBlockHeight and GetMipBlockDepth 2019-06-20 21:36:12 -03:00
Lioncash
3b97777861 common/bit_util: Make CountLeading/CountTrailing functions have the same return types
Makes the return type consistently uniform (like the intrinsics we're
wrapping). This also conveniently silences a truncation warning within
the kernel multi_level_queue.
2019-04-05 15:29:40 -04:00
Fernando Sahmkow
1e7fd04059 Fixes and corrections on formatting. 2019-03-27 14:49:43 -04:00
Fernando Sahmkow
10cedd8bd7 Implement intrinsics CountTrailingZeroes and test it. 2019-03-27 14:34:29 -04:00
Fernando Sahmkow
8c04ac69c5 Implement a MultiLevelQueue 2019-03-27 14:33:44 -04:00
Lioncash
0a9a9e9b80 common: Add basic bit manipulation utility function to Common 2018-12-21 07:04:18 -05:00