diff options
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; |