aboutsummaryrefslogtreecommitdiffstats
path: root/memory/rawmemchr.c
diff options
context:
space:
mode:
Diffstat (limited to 'memory/rawmemchr.c')
-rw-r--r--memory/rawmemchr.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/memory/rawmemchr.c b/memory/rawmemchr.c
new file mode 100644
index 0000000..496fe8a
--- /dev/null
+++ b/memory/rawmemchr.c
@@ -0,0 +1,9 @@
+#include "memory.h"
+
+void *rawmemchr(void const *buf, int value)
+{
+ unsigned char const *buffer = buf;
+ for (size_t i = 0;; i++)
+ if (buffer[i] == (unsigned char)value)
+ return (void *)&buffer[i];
+}