memset.c revision 169695
1169695Skan/* memset 2169695Skan This implementation is in the public domain. */ 3169695Skan 4169695Skan/* 5169695Skan 6169695Skan@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count}) 7169695Skan 8169695SkanSets the first @var{count} bytes of @var{s} to the constant byte 9169695Skan@var{c}, returning a pointer to @var{s}. 10169695Skan 11169695Skan@end deftypefn 12169695Skan 13169695Skan*/ 14169695Skan 15169695Skan#include <ansidecl.h> 16169695Skan#include <stddef.h> 17169695Skan 18169695SkanPTR 19169695Skanmemset (PTR dest, register int val, register size_t len) 20169695Skan{ 21169695Skan register unsigned char *ptr = (unsigned char*)dest; 22169695Skan while (len-- > 0) 23169695Skan *ptr++ = val; 24169695Skan return dest; 25169695Skan} 26