From 73e7e3637506f281e178208c55c2717e6c91eda2 Mon Sep 17 00:00:00 2001 From: Alejandro Javier Asenjo Nitti Date: Mon, 16 Oct 2023 13:54:00 -0300 Subject: [PATCH] decompile strchr --- src/libultra/libc/string.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/libultra/libc/string.c b/src/libultra/libc/string.c index 7a3db93f..e60b64c0 100644 --- a/src/libultra/libc/string.c +++ b/src/libultra/libc/string.c @@ -25,4 +25,15 @@ size_t strlen(const char* s) { } -#pragma GLOBAL_ASM("asm/us/nonmatchings/libultra/libc/string/strchr.s") +const char* strchr(const char* s, int c) { + const unsigned char ch = c; + + while (*s != ch) { + if (*s == '\0') { + return NULL; + } + s++; + } + + return s; +}