aboutsummaryrefslogtreecommitdiffstats
path: root/libkeccak_state_marshal.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libkeccak_state_marshal.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/libkeccak_state_marshal.c b/libkeccak_state_marshal.c
index c4ce7f6..e4d2efa 100644
--- a/libkeccak_state_marshal.c
+++ b/libkeccak_state_marshal.c
@@ -2,17 +2,22 @@
#include "common.h"
+#if defined(__clang__)
+# pragma clang diagnostic ignored "-Wcast-align"
+#endif
+
+
/**
* Marshal a `struct libkeccak_state` into a buffer
*
* @param state The state to marshal
- * @param data The output buffer, can be `NULL`
+ * @param data_ The output buffer, can be `NULL`
* @return The number of bytes stored to `data`
*/
size_t
libkeccak_state_marshal(const struct libkeccak_state *restrict state, void *restrict data_)
{
-#define set(type, var) *((type *)data) = state->var, data += sizeof(type) / sizeof(char)
+#define set(type, var) *((type *)data) = state->var, data += sizeof(type)
unsigned char *restrict data = data_;
if (data) {
set(long int, r);
@@ -24,7 +29,7 @@ libkeccak_state_marshal(const struct libkeccak_state *restrict state, void *rest
set(long int, l);
set(long int, nr);
memcpy(data, state->S, sizeof(state->S));
- data += sizeof(state->S) / sizeof(char);
+ data += sizeof(state->S);
set(size_t, mptr);
set(size_t, mlen);
memcpy(data, state->M, state->mptr * sizeof(char));