common/bit_util: Replace CLZ/CTZ operations with standardized ones
Makes for less code that we need to maintain.
This commit is contained in:
parent
c8bf0caca0
commit
8620de6b20
10 changed files with 17 additions and 113 deletions
|
@ -1,6 +1,5 @@
|
|||
add_executable(tests
|
||||
common/bit_field.cpp
|
||||
common/bit_utils.cpp
|
||||
common/fibers.cpp
|
||||
common/param_package.cpp
|
||||
common/ring_buffer.cpp
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
// Copyright 2017 Citra Emulator Project
|
||||
// Licensed under GPLv2 or any later version
|
||||
// Refer to the license.txt file included.
|
||||
|
||||
#include <catch2/catch.hpp>
|
||||
#include <math.h>
|
||||
#include "common/bit_util.h"
|
||||
|
||||
namespace Common {
|
||||
|
||||
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
|
Loading…
Add table
Add a link
Reference in a new issue