Skip to content

Commit dcca178

Browse files
committed
Minor cleanup
1 parent a4f2b36 commit dcca178

File tree

5 files changed

+17
-14
lines changed

5 files changed

+17
-14
lines changed

CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
3333
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
3434
-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type
3535
)
36+
# TODO: Remove this later.
37+
# Some variables have been provided but are not currently being used, but it would not atm make sense to remove them.
38+
# So to clean up the warnings we are just silencing these specific cases.
39+
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
40+
-Wno-unused-but-set-variable -Wno-unused-value
41+
)
3642
endif()
3743

3844
if(CMAKE_CXX_COMPILER_ID STREQUAL MSVC)

include/ccmath/detail/exponential/details/log2_double_impl.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,17 +54,15 @@ namespace ccm::internal
5454
ccm::double_t logExpoSum{};
5555
ccm::double_t polynomialTerm{};
5656

57-
std::uint64_t intX{};
5857
std::uint64_t intNorm{};
5958
std::uint64_t tmp{};
6059

61-
std::uint32_t top{};
6260

63-
int expo{};
64-
int i{};
61+
std::int64_t expo{};
62+
std::int64_t i{};
6563

66-
intX = ccm::helpers::double_to_uint64(x);
67-
top = ccm::helpers::top16_bits_of_double(x);
64+
std::uint64_t intX = ccm::helpers::double_to_uint64(x);
65+
std::uint32_t top = ccm::helpers::top16_bits_of_double(x);
6866

6967
constexpr std::uint64_t low = ccm::helpers::double_to_uint64(1.0 - 0x1.5b51p-5);
7068
constexpr std::uint64_t high = ccm::helpers::double_to_uint64(1.0 + 0x1.6ab2p-5);

include/ccmath/detail/exponential/details/log_double_impl.hpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -52,18 +52,16 @@ namespace ccm::internal
5252
ccm::double_t lowPart{};
5353

5454
// Declare variables for bitwise operations
55-
std::uint64_t intX{};
5655
std::uint64_t intNorm{};
5756
std::uint64_t tmp{};
58-
std::uint32_t top{};
5957

6058
// Declare variables for exponent and loop iteration
61-
int expo{};
62-
int i{};
59+
std::int64_t expo{};
60+
std::int64_t i{};
6361

6462
// Convert input double to uint64_t and extract top 16 bits
65-
intX = ccm::helpers::double_to_uint64(x);
66-
top = ccm::helpers::top16_bits_of_double(x);
63+
std::uint64_t intX = ccm::helpers::double_to_uint64(x);
64+
std::uint32_t top = ccm::helpers::top16_bits_of_double(x);
6765

6866
// Constants for comparison
6967
constexpr std::uint64_t low = ccm::helpers::double_to_uint64(1.0 - 0x1p-4);

include/ccmath/internal/helpers/bits.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ namespace ccm::helpers
7474
*/
7575
inline constexpr std::uint32_t top16_bits_of_double(double x) noexcept
7676
{
77-
return bit_cast<std::uint64_t>(x) >> 48;
77+
return static_cast<std::uint32_t>(bit_cast<std::uint64_t>(x) >> 48);
7878
}
7979

8080
inline constexpr std::uint32_t top12_bits_of_double(double x) noexcept
8181
{
82-
return bit_cast<std::uint64_t>(x) >> 52;
82+
return static_cast<std::uint32_t>(bit_cast<std::uint64_t>(x) >> 52);
8383
}
8484

8585
inline constexpr std::uint64_t double_to_uint64(double x) noexcept

test/ccmath_test_main.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
*/
88

99
#include <gtest/gtest.h>
10+
#include "ccmath/ccmath.hpp"
1011

1112

1213
int main(int argc, char** argv)

0 commit comments

Comments
 (0)