helper: Remove alignof for memcpyAligned()
The alignof() is not used properly in memcpyAligned().
It was looking for memcpyAligned(void*) == alignof(std::uint64_t), which
will always be true and does not do anything. Replace it with a simple
check instead. Mod the pointer address with the size of uint16_t.
Change-Id: Ia6e8a26ad7cf2dc04510f857965003319aba269a
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/tools/helper.cpp b/tools/helper.cpp
index a20baac..d612922 100644
--- a/tools/helper.cpp
+++ b/tools/helper.cpp
@@ -178,8 +178,9 @@
std::size_t i = 0;
std::size_t bytesCopied = 0;
- if ((alignof(destination) == alignof(std::uint64_t)) &&
- (alignof(source) == alignof(std::uint64_t)))
+ if (!(reinterpret_cast<std::uintptr_t>(destination) %
+ sizeof(std::uint64_t)) &&
+ !(reinterpret_cast<std::uintptr_t>(source) % sizeof(std::uint64_t)))
{
auto src64 = reinterpret_cast<const volatile std::uint64_t*>(source);
auto dest64 = reinterpret_cast<volatile std::uint64_t*>(destination);