mirror of
https://github.com/yuzu-emu/yuzu-android.git
synced 2025-06-26 02:28:00 -05:00
Fixes and corrections on formatting.
This commit is contained in:
committed by
FernandoS27
parent
f35e09fe0d
commit
db42bcb306
@ -8,35 +8,16 @@
|
||||
|
||||
namespace Common {
|
||||
|
||||
inline u32 CTZ32(u32 value) {
|
||||
u32 count = 0;
|
||||
while (((value >> count) & 0xf) == 0 && count < 32)
|
||||
count += 4;
|
||||
while (((value >> count) & 1) == 0 && count < 32)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
inline u64 CTZ64(u64 value) {
|
||||
u64 count = 0;
|
||||
while (((value >> count) & 0xf) == 0 && count < 64)
|
||||
count += 4;
|
||||
while (((value >> count) & 1) == 0 && count < 64)
|
||||
count++;
|
||||
return count;
|
||||
}
|
||||
|
||||
|
||||
TEST_CASE("BitUtils", "[common]") {
|
||||
REQUIRE(Common::CountTrailingZeroes32(0) == CTZ32(0));
|
||||
REQUIRE(Common::CountTrailingZeroes64(0) == CTZ64(0));
|
||||
REQUIRE(Common::CountTrailingZeroes32(9) == CTZ32(9));
|
||||
REQUIRE(Common::CountTrailingZeroes32(8) == CTZ32(8));
|
||||
REQUIRE(Common::CountTrailingZeroes32(0x801000) == CTZ32(0x801000));
|
||||
REQUIRE(Common::CountTrailingZeroes64(9) == CTZ64(9));
|
||||
REQUIRE(Common::CountTrailingZeroes64(8) == CTZ64(8));
|
||||
REQUIRE(Common::CountTrailingZeroes64(0x801000) == CTZ64(0x801000));
|
||||
REQUIRE(Common::CountTrailingZeroes64(0x801000000000UL) == CTZ64(0x801000000000UL));
|
||||
TEST_CASE("BitUtils::CountTrailingZeroes", "[common]") {
|
||||
REQUIRE(Common::CountTrailingZeroes32(0) == 32);
|
||||
REQUIRE(Common::CountTrailingZeroes64(0) == 64);
|
||||
REQUIRE(Common::CountTrailingZeroes32(9) == 0);
|
||||
REQUIRE(Common::CountTrailingZeroes32(8) == 3);
|
||||
REQUIRE(Common::CountTrailingZeroes32(0x801000) == 12);
|
||||
REQUIRE(Common::CountTrailingZeroes64(9) == 0);
|
||||
REQUIRE(Common::CountTrailingZeroes64(8) == 3);
|
||||
REQUIRE(Common::CountTrailingZeroes64(0x801000) == 12);
|
||||
REQUIRE(Common::CountTrailingZeroes64(0x801000000000UL) == 36);
|
||||
}
|
||||
|
||||
} // namespace Common
|
||||
|
Reference in New Issue
Block a user