xv6

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 8220135362c02b5e4a5532a561c6c1bd4b4d1540
parent c396d065d3f5e5a0f966857d710a434a2f2db066
Author: rsc <rsc>
Date:   Sun,  8 Mar 2009 21:38:30 +0000

xv6: use stosb for memset

Diffstat:
Mstring.c | 8++------
Mulib.c | 7++-----
2 files changed, 4 insertions(+), 11 deletions(-)

diff --git 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 @@ -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; }