aboutsummaryrefslogtreecommitdiffstats
path: root/rawmemchr.c
diff options
context:
space:
mode:
Diffstat (limited to 'rawmemchr.c')
-rw-r--r--rawmemchr.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/rawmemchr.c b/rawmemchr.c
new file mode 100644
index 0000000..6dd8496
--- /dev/null
+++ b/rawmemchr.c
@@ -0,0 +1,11 @@
+/* See LICENSE file for copyright and license details. */
+#include "libsimple.h"
+
+
+void *
+libsimple_rawmemchr(const void *s_, int c)
+{
+ char *s = *(char **)(void *)&s_;
+ while ((int)*s++ != c);
+ return &s[-1];
+}