feat: kernel and libc performance improvements

This commit is contained in:
2026-04-10 17:30:31 +02:00
parent 906828f3ec
commit b72bdca3a2
3 changed files with 95 additions and 37 deletions
+6 -5
View File
@@ -417,9 +417,9 @@ void *memchr(const void *s, int c, size_t n) {
}
size_t strlen(const char *s) {
size_t len = 0;
while (s[len]) len++;
return len;
const char *p = s;
while (*p) p++;
return p - s;
}
size_t strspn(const char *s, const char *accept) {
@@ -441,8 +441,9 @@ size_t strcspn(const char *s, const char *reject) {
}
int strcmp(const char *a, const char *b) {
while (*a && *a == *b) { a++; b++; }
return (unsigned char)*a - (unsigned char)*b;
const char *pa = a, *pb = b;
while (*pa && *pa == *pb) { pa++; pb++; }
return (unsigned char)*pa - (unsigned char)*pb;
}
int strncmp(const char *a, const char *b, size_t n) {