xv6: use stosb for memset

This commit is contained in:
rsc 2009-03-08 21:38:30 +00:00
parent c396d065d3
commit 8220135362
2 changed files with 4 additions and 11 deletions

View file

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

7
ulib.c
View file

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