19 while (len < n && str[len])
27 while (s1[i] && s2[i] && s1[i] == s2[i])
49 for (
size_t i = 0; i < n; i++)
51 unsigned char a_byte =
tolower(a[i]);
52 unsigned char b_byte =
tolower(b[i]);
53 if (!a_byte && !b_byte)
64void *
memcpy(
void *__restrict _dst,
const void *__restrict _src,
size_t n)
68#define UNALIGNED(X, Y) (((long) X & (sizeof(long) - 1)) | ((long) Y & (sizeof(long) - 1)))
69#define BIGBLOCKSIZE (sizeof(long) << 2)
70#define LITTLEBLOCKSIZE (sizeof(long))
71#define TOO_SMALL(LEN) ((LEN) < BIGBLOCKSIZE)
74 const char *src = _src;
80 long *aligned_dst = (
long *) dst;
81 const long *aligned_src = (
long *) src;
86 *aligned_dst++ = *aligned_src++;
87 *aligned_dst++ = *aligned_src++;
88 *aligned_dst++ = *aligned_src++;
89 *aligned_dst++ = *aligned_src++;
96 *aligned_dst++ = *aligned_src++;
101 dst = (
char *) aligned_dst;
102 src = (
char *) aligned_src;
111void *
memmove(
void *dest,
const void *source,
size_t length)
115 const char *src = source;
117 if (src < dst && dst < src + length)
137 for (
size_t i = 0; i < n; i++)
142int memcmp(
const void *s1,
const void *s2,
size_t n)
144 const u8 *p1 = s1, *p2 = s2;
145 for (
size_t i = 0; i < n; i++)
148 return p1[i] - p2[i];
155 typedef u64 largeint_t;
156 largeint_t *lsrc = (largeint_t *) s;
158 while (n >=
sizeof(largeint_t))
161 n -=
sizeof(largeint_t);
164 char *csrc = (
char *) lsrc;
173void *
memchr(
const void *m,
int c,
size_t n)
176 for (
size_t i = 0; i < n; i++)
179 return (
void *) &s[i];
184char *
strcpy(
char *__restrict dest,
const char *__restrict src)
192char *
strcat(
char *__restrict dest,
const char *__restrict src)
202char *
strncpy(
char *__restrict dest,
const char *__restrict src,
size_t n)
205 while (n > 0 && *src)
220char *
strdup(
const char *src)
222 char *dst = malloc(
strlen(src) + 1);
227char *
strndup(
const char *src,
size_t len)
229 char *dst = malloc(len + 1);
249 const char *last =
NULL;
255 return (
char *) last;
258size_t strspn(
const char *s,
const char *accept)
263 if (!
strchr(accept, s[i]))
270char *
strpbrk(
const char *s,
const char *accept)
281char *
strtok(
char *str,
const char *delim)
288 str +=
strspn(str, delim);
303char *
strtok_r(
char *str,
const char *delim,
char **saveptr)
311 str +=
strspn(str, delim);
314 return *saveptr =
NULL;
char * strcat(char *__restrict dest, const char *__restrict src)
void * memset(void *s, int c, size_t n)
char * strchr(const char *s, int c)
void * memchr(const void *m, int c, size_t n)
char * strtok(char *str, const char *delim)
size_t strspn(const char *s, const char *accept)
char * strcpy(char *__restrict dest, const char *__restrict src)
s32 strncasecmp(const char *a, const char *b, size_t n)
char * strrchr(const char *s, int c)
MOSAPI char * strdup(const char *src)
char * strncpy(char *__restrict dest, const char *__restrict src, size_t n)
int memcmp(const void *s1, const void *s2, size_t n)
void * memcpy(void *__restrict _dst, const void *__restrict _src, size_t n)
size_t strlen(const char *str)
void * memmove(void *dest, const void *source, size_t length)
s32 strncmp(const char *str1, const char *str2, size_t n)
char * strtok_r(char *str, const char *delim, char **saveptr)
s32 strcmp(const char *s1, const char *s2)
size_t strnlen(const char *str, size_t n)
char * strpbrk(const char *s, const char *accept)
MOSAPI char * strndup(const char *src, size_t n)
MOSAPI unsigned char tolower(unsigned char c)
#define memzero(ptr, size)