From f7eede23de6f78b2b33b477b2b4c5451141825d5 Mon Sep 17 00:00:00 2001 From: Dominick Allen Date: Wed, 2 Oct 2024 19:51:41 -0500 Subject: Add setup for coverage and cppcheck. --- include/fud_memory.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'include/fud_memory.hpp') diff --git a/include/fud_memory.hpp b/include/fud_memory.hpp index 41393bd..62ff81a 100644 --- a/include/fud_memory.hpp +++ b/include/fud_memory.hpp @@ -77,7 +77,7 @@ void copyMem(T& destination, const U& source) for (size_t idx = 0; idx < Count; ++idx) { // NOLINTBEGIN(cppcoreguidelines-pro-type-reinterpret-cast) - reinterpret_cast(&destination)[idx] = reinterpret_cast(&source)[idx]; + reinterpret_cast(&destination)[idx] = reinterpret_cast(&source)[idx]; // NOLINTEND(cppcoreguidelines-pro-type-reinterpret-cast) } } @@ -115,11 +115,13 @@ int compareMem(const T& lhs, U&& rhs) static_assert(Count <= sizeof(T)); static_assert(Count <= sizeof(U)); + U uRhs{std::forward(rhs)}; + int difference = 0; for (size_t idx = 0; idx < Count; ++idx) { // NOLINTBEGIN(cppcoreguidelines-pro-type-reinterpret-cast) difference = reinterpret_cast(&lhs)[idx] - - reinterpret_cast(&std::forward(rhs))[idx]; + reinterpret_cast(&uRhs)[idx]; // NOLINTEND(cppcoreguidelines-pro-type-reinterpret-cast) if (difference != 0) { break; -- cgit v1.2.3