diff options
author | Dominick Allen <djallen@librehumanitas.org> | 2024-10-02 19:51:41 -0500 |
---|---|---|
committer | Dominick Allen <djallen@librehumanitas.org> | 2024-10-02 19:51:41 -0500 |
commit | f7eede23de6f78b2b33b477b2b4c5451141825d5 (patch) | |
tree | d698a92272b8e4a8428b82d9a21f3e98ed267a6d /include/fud_memory.hpp | |
parent | 32c722d50943bbdeba65a77d5e94f8692cf75f3c (diff) |
Add setup for coverage and cppcheck.
Diffstat (limited to 'include/fud_memory.hpp')
-rw-r--r-- | include/fud_memory.hpp | 6 |
1 files changed, 4 insertions, 2 deletions
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<uint8_t*>(&destination)[idx] = reinterpret_cast<const uint8_t*>(&source)[idx]; + reinterpret_cast<char*>(&destination)[idx] = reinterpret_cast<const char*>(&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<U>(rhs)}; + int difference = 0; for (size_t idx = 0; idx < Count; ++idx) { // NOLINTBEGIN(cppcoreguidelines-pro-type-reinterpret-cast) difference = reinterpret_cast<const uint8_t*>(&lhs)[idx] - - reinterpret_cast<const uint8_t*>(&std::forward<U>(rhs))[idx]; + reinterpret_cast<const uint8_t*>(&uRhs)[idx]; // NOLINTEND(cppcoreguidelines-pro-type-reinterpret-cast) if (difference != 0) { break; |