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