Commit graph

12 commits

Author SHA1 Message Date
Morph
d92b5fc435 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
da2fe81905 TextureCache: Refactor and fix linux compiling. 2021-11-20 14:46:19 +01:00
bunnei
1e9b1d439f
common: Add missing include to bit_util.h 2021-01-21 15:30:28 -08:00
Lioncash
6ff2db181f 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
8620de6b20 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
df72480395 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
94f2be5473 texture_cache: Optimize GetMipBlockHeight and GetMipBlockDepth 2019-06-20 21:36:12 -03:00
Lioncash
33db37e669 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
db42bcb306 Fixes and corrections on formatting. 2019-03-27 14:49:43 -04:00
Fernando Sahmkow
3bc815a5dc Implement intrinsics CountTrailingZeroes and test it. 2019-03-27 14:34:29 -04:00
Fernando Sahmkow
522957f9f3 Implement a MultiLevelQueue 2019-03-27 14:33:44 -04:00
Lioncash
fc8da2d5e3 common: Add basic bit manipulation utility function to Common 2018-12-21 07:04:18 -05:00