aboutsummaryrefslogtreecommitdiff
path: root/src/base/mem/findc.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/base/mem/findc.c')
-rw-r--r--src/base/mem/findc.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/base/mem/findc.c b/src/base/mem/findc.c
new file mode 100644
index 0000000..d3215c5
--- /dev/null
+++ b/src/base/mem/findc.c
@@ -0,0 +1,14 @@
+#include "internal.h"
+
+void *
+mem·findc(void *addr, uintptr len, int c)
+{
+ uchar *a = addr;
+
+ c &= 0xFF;
+ while(len-- > 0){
+ if(*a++ == c)
+ return a-1;
+ }
+ return nil;
+}