inline string functions to movsb/stosb
diff --git a/Makefile b/Makefile
index 64da22a..621919c 100644
--- a/Makefile
+++ b/Makefile
@@ -13,6 +13,7 @@
BIOS_CFLAGS += -mregparm=3
BIOS_CFLAGS += -fno-stack-protector -fno-delete-null-pointer-checks
BIOS_CFLAGS += -ffreestanding
+BIOS_CFLAGS += -mstringop-strategy=rep_byte -minline-all-stringops
BIOS_CFLAGS += -Iinclude
dummy := $(shell mkdir -p .deps)
diff --git a/include/string.h b/include/string.h
index fb20869..c939cd0 100644
--- a/include/string.h
+++ b/include/string.h
@@ -9,12 +9,20 @@
int strcmp(const char *a, const char *b);
char *strchr(const char *s, int c);
char *strstr(const char *s1, const char *s2);
-void *memset(void *s, int c, size_t n);
-void *memcpy(void *dest, const void *src, size_t n);
int memcmp(const void *s1, const void *s2, size_t n);
void *memmove(void *dest, const void *src, size_t n);
void *memchr(const void *s, int c, size_t n);
+static inline void *memset(void *s, int c, size_t n)
+{
+ return __builtin_memset(s, c, n);
+}
+
+static inline void *memcpy(void *dest, const void *src, size_t n)
+{
+ return __builtin_memcpy(dest, src, n);
+}
+
void *malloc(int n);
void *malloc_fseg(int n);
diff --git a/string.c b/string.c
index 3029b9f..8d1cb7a 100644
--- a/string.c
+++ b/string.c
@@ -62,29 +62,6 @@
return NULL;
}
-void *memset(void *s, int c, size_t n)
-{
- size_t i;
- char *a = s;
-
- for (i = 0; i < n; ++i)
- a[i] = c;
-
- return s;
-}
-
-void *memcpy(void *dest, const void *src, size_t n)
-{
- size_t i;
- char *a = dest;
- const char *b = src;
-
- for (i = 0; i < n; ++i)
- a[i] = b[i];
-
- return dest;
-}
-
int memcmp(const void *s1, const void *s2, size_t n)
{
const unsigned char *a = s1, *b = s2;