aboutsummaryrefslogtreecommitdiffstats
path: root/rawmemrelem_inv.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2022-06-11 16:37:09 +0200
committerMattias Andrée <maandree@kth.se>2022-06-11 16:37:09 +0200
commitfcfe59c1f2219408ac2a9cd84b386816ff252221 (patch)
tree0f46c009babfba2d0200ece3ecce067c548a66b6 /rawmemrelem_inv.c
parentRemove `static` from some `static inline` (diff)
downloadlibsimple-fcfe59c1f2219408ac2a9cd84b386816ff252221.tar.gz
libsimple-fcfe59c1f2219408ac2a9cd84b386816ff252221.tar.bz2
libsimple-fcfe59c1f2219408ac2a9cd84b386816ff252221.tar.xz
Fix warnings, replace some static inline with inline + extern inline, and fix glibc support
Diffstat (limited to 'rawmemrelem_inv.c')
-rw-r--r--rawmemrelem_inv.c28
1 files changed, 14 insertions, 14 deletions
diff --git a/rawmemrelem_inv.c b/rawmemrelem_inv.c
index 74a3cfc..e39a271 100644
--- a/rawmemrelem_inv.c
+++ b/rawmemrelem_inv.c
@@ -11,42 +11,42 @@ libsimple_rawmemrelem_inv(const void *hay_, const void *sub_, size_t width, size
abort();
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; *--hay == sub;);
- return hay;
+ return REMOVE_CONST(hay, uint8_t *);
}
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; *--hay == sub;);
- 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 += n; *--hay == sub;);
- 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 += n; *--hay == sub;);
- 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 += n * width;;) {
hay -= width;
for (i = 0; i < width; i++)
if (hay[i] != sub[i])
- return hay;
+ return REMOVE_CONST(hay, char *);
}
}
}