xv6: use stosb for memset
This commit is contained in:
parent
c396d065d3
commit
8220135362
2 changed files with 4 additions and 11 deletions
8
string.c
8
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;
|
||||
}
|
||||
|
||||
|
|
7
ulib.c
7
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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue