aboutsummaryrefslogtreecommitdiffstats
path: root/memelemscan_inv.c
diff options
context:
space:
mode:
Diffstat (limited to 'memelemscan_inv.c')
-rw-r--r--memelemscan_inv.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/memelemscan_inv.c b/memelemscan_inv.c
index 37b479a..cdbae3c 100644
--- a/memelemscan_inv.c
+++ b/memelemscan_inv.c
@@ -1,5 +1,5 @@
/* See LICENSE file for copyright and license details. */
-#include "libsimple.h"
+#include "common.h"
#ifndef TEST
@@ -8,41 +8,41 @@ libsimple_memelemscan_inv(const void *hay_, const void *sub_, size_t width, size
{
switch (width) {
case 0:
- return (void *)hay_;
+ return REMOVE_CONST(hay_, void *);
case 1:
- return libsimple_memscan_inv(hay_, *(char *)sub_, n);
+ return libsimple_memscan_inv(hay_, *(const char *)sub_, n);
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 (; n-- && *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 (; n-- && *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 (; n-- && *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 (; n--; hay += width) {
for (i = 0; i < width; i++)
if (hay[i] != sub[i])
- return hay;
+ return REMOVE_CONST(hay, char *);
}
- return hay;
+ return REMOVE_CONST(hay, char *);
}
}
}