diff options
author | Mattias Andrée <maandree@kth.se> | 2024-08-18 09:58:23 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@kth.se> | 2024-08-18 09:58:23 +0200 |
commit | a69f0f613687edf6c1f1ee83b462f77e8ea3c9a9 (patch) | |
tree | d976683461a0f427d2f1ef79a8732a048dd0c67b /rawmemelem_inv.c | |
parent | Merge tag '1.3' into since (diff) | |
parent | Update VERSION_MINOR (diff) | |
download | libsimple-a69f0f613687edf6c1f1ee83b462f77e8ea3c9a9.tar.gz libsimple-a69f0f613687edf6c1f1ee83b462f77e8ea3c9a9.tar.bz2 libsimple-a69f0f613687edf6c1f1ee83b462f77e8ea3c9a9.tar.xz |
Merge tag '1.4' into since
Version 1.4
Diffstat (limited to 'rawmemelem_inv.c')
-rw-r--r-- | rawmemelem_inv.c | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/rawmemelem_inv.c b/rawmemelem_inv.c index 7046d3c..1e8bc00 100644 --- a/rawmemelem_inv.c +++ b/rawmemelem_inv.c @@ -1,5 +1,5 @@ /* See LICENSE file for copyright and license details. */ -#include "libsimple.h" +#include "common.h" #ifndef TEST @@ -10,37 +10,37 @@ libsimple_rawmemelem_inv(const void *hay_, const void *sub_, size_t width) case 0: abort(); case 1: - return rawmemchr_inv(hay_, *(char *)sub_); + return rawmemchr_inv(hay_, *(const char *)sub_); case 2: { - uint16_t *hay = (void *)hay_; - uint16_t sub = *(uint16_t *)sub_; + const uint16_t *hay = hay_; + uint16_t sub = *(const uint16_t *)sub_; for (; *hay == sub; hay++); - return hay; + return REMOVE_CONST(hay, uint16_t *); } case 4: { - uint32_t *hay = (void *)hay_; - uint32_t sub = *(uint32_t *)sub_; + const uint32_t *hay = hay_; + uint32_t sub = *(const uint32_t *)sub_; for (; *hay == sub; hay++); - return hay; + return REMOVE_CONST(hay, uint32_t *); } case 8: { - uint64_t *hay = (void *)hay_; - uint64_t sub = *(uint64_t *)sub_; + const uint64_t *hay = hay_; + uint64_t sub = *(const uint64_t *)sub_; for (; *hay == sub; hay++); - return hay; + return REMOVE_CONST(hay, uint64_t *); } default: { - char *hay = (void *)hay_; + const char *hay = hay_; const char *sub = sub_; size_t i; for (;; hay += width) for (i = 0; i < width; i++) if (hay[i] != sub[i]) - return hay; + return REMOVE_CONST(hay, void *); } } } |