diff options
author | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-07-03 12:14:56 +0300 |
---|---|---|
committer | Jussi Kivilinna <jussi.kivilinna@iki.fi> | 2013-07-10 21:54:42 +0300 |
commit | c3902a6b5cea9acef2e15fbee24eb601eeb25168 (patch) | |
tree | 151341367d89cf87ec8deab6478d973cb8098e48 /cipher/bufhelp.h | |
parent | 97f392f43cf2e4da1297cbecacbfbff33a869478 (diff) | |
download | libgcrypt-c3902a6b5cea9acef2e15fbee24eb601eeb25168.tar.gz |
bufhelp: Suppress 'cast increases required alignment' warning
* cipher/bufhelp.h (buf_xor, buf_xor_2dst, buf_xor_n_copy): Cast
to larger element pointer through (void *) to suppress -Wcast-error.
--
Patch disables bogus warnings caused by -Wcast-error. We know that byte
pointers are properly aligned at these phases, or that hardware can handle
unaligned accesses.
Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
Diffstat (limited to 'cipher/bufhelp.h')
-rw-r--r-- | cipher/bufhelp.h | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/cipher/bufhelp.h b/cipher/bufhelp.h index 638ca1b2..1c173e27 100644 --- a/cipher/bufhelp.h +++ b/cipher/bufhelp.h @@ -30,7 +30,7 @@ #if defined(__i386__) || defined(__x86_64__) -/* These architechtures are able of unaligned memory accesses and can +/* These architectures are able of unaligned memory accesses and can handle those fast. */ # define BUFHELP_FAST_UNALIGNED_ACCESS 1 @@ -59,9 +59,9 @@ buf_xor(void *_dst, const void *_src1, const void *_src2, size_t len) *dst++ = *src1++ ^ *src2++; #endif - ldst = (uintptr_t *)dst; - lsrc1 = (const uintptr_t *)src1; - lsrc2 = (const uintptr_t *)src2; + ldst = (uintptr_t *)(void *)dst; + lsrc1 = (const uintptr_t *)(const void *)src1; + lsrc2 = (const uintptr_t *)(const void *)src2; for (; len >= sizeof(uintptr_t); len -= sizeof(uintptr_t)) *ldst++ = *lsrc1++ ^ *lsrc2++; @@ -102,9 +102,9 @@ buf_xor_2dst(void *_dst1, void *_dst2, const void *_src, size_t len) *dst1++ = (*dst2++ ^= *src++); #endif - ldst1 = (uintptr_t *)dst1; - ldst2 = (uintptr_t *)dst2; - lsrc = (const uintptr_t *)src; + ldst1 = (uintptr_t *)(void *)dst1; + ldst2 = (uintptr_t *)(void *)dst2; + lsrc = (const uintptr_t *)(const void *)src; for (; len >= sizeof(uintptr_t); len -= sizeof(uintptr_t)) *ldst1++ = (*ldst2++ ^= *lsrc++); @@ -151,9 +151,9 @@ buf_xor_n_copy(void *_dst_xor, void *_srcdst_cpy, const void *_src, size_t len) } #endif - ldst_xor = (uintptr_t *)dst_xor; - lsrcdst_cpy = (uintptr_t *)srcdst_cpy; - lsrc = (const uintptr_t *)src; + ldst_xor = (uintptr_t *)(void *)dst_xor; + lsrcdst_cpy = (uintptr_t *)(void *)srcdst_cpy; + lsrc = (const uintptr_t *)(const void *)src; for (; len >= sizeof(uintptr_t); len -= sizeof(uintptr_t)) { |