summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrsc <rsc>2009-03-08 21:38:30 +0000
committerrsc <rsc>2009-03-08 21:38:30 +0000
commit8220135362c02b5e4a5532a561c6c1bd4b4d1540 (patch)
tree8c5d30bc8ec0756c43579a88480fc2cbc5d113a9
parentc396d065d3f5e5a0f966857d710a434a2f2db066 (diff)
downloadxv6-labs-8220135362c02b5e4a5532a561c6c1bd4b4d1540.tar.gz
xv6-labs-8220135362c02b5e4a5532a561c6c1bd4b4d1540.tar.bz2
xv6-labs-8220135362c02b5e4a5532a561c6c1bd4b4d1540.zip
xv6: use stosb for memset
-rw-r--r--string.c8
-rw-r--r--ulib.c7
2 files changed, 4 insertions, 11 deletions
diff --git a/string.c b/string.c
index c6b6de6..cb890ee 100644
--- a/string.c
+++ b/string.c
@@ -1,14 +1,10 @@
#include "types.h"
+#include "x86.h"
void*
memset(void *dst, int c, uint n)
{
- char *d;
-
- d = (char*)dst;
- while(n-- > 0)
- *d++ = c;
-
+ stosb(dst, c, n);
return dst;
}
diff --git a/ulib.c b/ulib.c
index ed2542d..0268c26 100644
--- a/ulib.c
+++ b/ulib.c
@@ -2,6 +2,7 @@
#include "stat.h"
#include "fcntl.h"
#include "user.h"
+#include "x86.h"
char*
strcpy(char *s, char *t)
@@ -35,11 +36,7 @@ strlen(char *s)
void*
memset(void *dst, int c, uint n)
{
- char *d;
-
- d = dst;
- while(n-- > 0)
- *d++ = c;
+ stosb(dst, c, n);
return dst;
}