M2: memset

This commit is contained in:
Jan Nieuwenhuizen 2019-10-26 09:11:33 +02:00
parent cb35345d85
commit c2ba415b1f
No known key found for this signature in database
GPG Key ID: F3C1A0D9C1D65273
1 changed files with 5 additions and 5 deletions

View File

@ -24,11 +24,11 @@ void *
memset (void *s, int c, int n)
{
char *p = s;
while (n)
while (n != 0)
{
n = n -1;
p[0] = c;
p = p + 1;
n = n - 1;
s[0] = c;
s = s + 1;
}
return s;
return p;
}