diff options
Diffstat (limited to '')
-rw-r--r-- | memrelem_inv.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/memrelem_inv.c b/memrelem_inv.c index d90f358..3bb0f89 100644 --- a/memrelem_inv.c +++ b/memrelem_inv.c @@ -11,50 +11,50 @@ libsimple_memrelem_inv(const void *hay_, const void *sub_, size_t width, size_t return NULL; case 1: { - uint8_t *hay = (void *)hay_; - uint8_t sub = *(uint8_t *)sub_; + const uint8_t *hay = hay_; + uint8_t sub = *(const uint8_t *)sub_; for (hay += n; n--;) if (*--hay != sub) - return hay; + return REMOVE_CONST(hay, uint8_t *); break; } 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 += n; n--;) 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 (hay += n; n--;) 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 (hay += n; n--;) 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 (hay += n * width; n--;) { hay -= width; for (i = 0; i < width; i++) if (hay[i] != sub[i]) - return hay; + return REMOVE_CONST(hay, char *); } break; } |