diff options
Diffstat (limited to 'memelem_inv.c')
-rw-r--r-- | memelem_inv.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/memelem_inv.c b/memelem_inv.c index dace2d4..7e87d4c 100644 --- a/memelem_inv.c +++ b/memelem_inv.c @@ -10,43 +10,43 @@ libsimple_memelem_inv(const void *hay_, const void *sub_, size_t width, size_t n case 0: return NULL; case 1: - return libsimple_memchr_inv(hay_, *(char *)sub_, n); + return libsimple_memchr_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++) if (*hay != sub) - return hay; + return REMOVE_CONST(hay, uint16_t *); break; } 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++) if (*hay != sub) - return hay; + return REMOVE_CONST(hay, uint32_t *); break; } 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++) if (*hay != sub) - return hay; + return REMOVE_CONST(hay, uint64_t *); break; } 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 *); } break; } |