2019-08-25 04:46:40 +00:00
|
|
|
#include "libultra_internal.h"
|
|
|
|
#include <string.h>
|
2019-11-03 19:36:27 +00:00
|
|
|
|
2019-08-25 04:46:40 +00:00
|
|
|
void *memcpy(void *dst, const void *src, size_t size) {
|
|
|
|
u8 *_dst = dst;
|
|
|
|
const u8 *_src = src;
|
|
|
|
while (size > 0) {
|
|
|
|
*_dst++ = *_src++;
|
|
|
|
size--;
|
|
|
|
}
|
|
|
|
return dst;
|
|
|
|
}
|
2019-11-03 19:36:27 +00:00
|
|
|
size_t strlen(const char *str) {
|
|
|
|
const u8 *ptr = (const u8 *) str;
|
2019-09-01 19:50:50 +00:00
|
|
|
while (*ptr) {
|
2019-08-25 04:46:40 +00:00
|
|
|
ptr++;
|
2019-09-01 19:50:50 +00:00
|
|
|
}
|
2019-11-03 19:36:27 +00:00
|
|
|
return (const char *) ptr - str;
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|
|
|
|
|
2019-11-03 19:36:27 +00:00
|
|
|
char *strchr(const char *str, s32 ch) {
|
2019-08-25 04:46:40 +00:00
|
|
|
u8 c = ch;
|
2019-11-03 19:36:27 +00:00
|
|
|
while (*(u8 *)str != c) {
|
|
|
|
if (*(u8 *)str == 0) {
|
2019-08-25 04:46:40 +00:00
|
|
|
return NULL;
|
2019-09-01 19:50:50 +00:00
|
|
|
}
|
2019-08-25 04:46:40 +00:00
|
|
|
str++;
|
|
|
|
}
|
2019-11-03 19:36:27 +00:00
|
|
|
return (char *) str;
|
2019-08-25 04:46:40 +00:00
|
|
|
}
|