memset.c revision 130562
171333Sitojun/* memset 2118787Sume This implementation is in the public domain. */ 362656Skris 455505Sshin/* 555505Sshin 655505Sshin@deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count}) 7222732Shrs 855505SshinSets the first @var{count} bytes of @var{s} to the constant byte 955505Sshin@var{c}, returning a pointer to @var{s}. 1055505Sshin 1155505Sshin@end deftypefn 1255505Sshin 1355505Sshin*/ 1455505Sshin 1555505Sshin#include <ansidecl.h> 1655505Sshin#ifdef ANSI_PROTOTYPES 1755505Sshin#include <stddef.h> 1855505Sshin#else 19222732Shrs#define size_t unsigned long 2055505Sshin#endif 2155505Sshin 2255505SshinPTR 2355505Sshinmemset (dest, val, len) 2455505Sshin PTR dest; 2555505Sshin register int val; 2655505Sshin register size_t len; 2755505Sshin{ 2855505Sshin register unsigned char *ptr = (unsigned char*)dest; 2955505Sshin while (len-- > 0) 3055505Sshin *ptr++ = val; 3155505Sshin return dest; 3255505Sshin} 33224144Shrs