From 9d6e3ae6efad4dbd3c95d279440ed25152c2b300 Mon Sep 17 00:00:00 2001 From: Jeffrey Walton Date: Sun, 24 Jan 2016 18:40:22 -0500 Subject: [PATCH] Cleared -Wcast-align (Issue 122) --- crc.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crc.cpp b/crc.cpp index 3a2cb4fe..0ddfe448 100644 --- a/crc.cpp +++ b/crc.cpp @@ -124,6 +124,7 @@ CRC32::CRC32() void CRC32::Update(const byte *s, size_t n) { + assert(IsAlignedOn(s,GetAlignmentOf())); word32 crc = m_crc; for(; !IsAligned(s) && n > 0; n--) @@ -131,7 +132,7 @@ void CRC32::Update(const byte *s, size_t n) while (n >= 4) { - crc ^= *(const word32 *)s; + crc ^= *(const word32 *)(void*)s; crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc); crc = m_tab[CRC32_INDEX(crc)] ^ CRC32_SHIFTED(crc);