aboutsummaryrefslogtreecommitdiffstats
path: root/libkeccak_state_unmarshal.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-07-30 18:06:26 +0200
committerMattias Andrée <maandree@kth.se>2021-07-30 18:06:26 +0200
commita198f806d60b641406955d6b8c494b2bd5d8989c (patch)
tree27883711145184fff8d9dc564d368383b1c675db /libkeccak_state_unmarshal.c
parentFix warning (diff)
downloadlibkeccak-a198f806d60b641406955d6b8c494b2bd5d8989c.tar.gz
libkeccak-a198f806d60b641406955d6b8c494b2bd5d8989c.tar.bz2
libkeccak-a198f806d60b641406955d6b8c494b2bd5d8989c.tar.xz
Do not divide by sizeof(char)
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to '')
-rw-r--r--libkeccak_state_unmarshal.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/libkeccak_state_unmarshal.c b/libkeccak_state_unmarshal.c
index e46db54..6922a3e 100644
--- a/libkeccak_state_unmarshal.c
+++ b/libkeccak_state_unmarshal.c
@@ -13,10 +13,10 @@
size_t
libkeccak_state_unmarshal(struct libkeccak_state *restrict state, const void *restrict data_)
{
-#define get(type, var) state->var = *((const type *)data), data += sizeof(type) / sizeof(char)
+#define get(type, var) state->var = *((const type *)data), data += sizeof(type)
const unsigned char *restrict data = data_;
if (!state) {
- data += (7 * sizeof(long int) + 26 * sizeof(int64_t)) / sizeof(char);
+ data += (7 * sizeof(long int) + 26 * sizeof(int64_t));
return sizeof(struct libkeccak_state) - sizeof(char *) + *(const size_t *)data * sizeof(char);
}
get(long int, r);
@@ -28,7 +28,7 @@ libkeccak_state_unmarshal(struct libkeccak_state *restrict state, const void *re
get(long int, l);
get(long int, nr);
memcpy(state->S, data, sizeof(state->S));
- data += sizeof(state->S) / sizeof(char);
+ data += sizeof(state->S);
get(size_t, mptr);
get(size_t, mlen);
state->M = malloc(state->mptr * sizeof(char));