PR 11225
[binutils.git] / libiberty / memset.c
blob1951ad6bd610c836367f8d0299f44f9ec13f8f7c
1 /* memset
2 This implementation is in the public domain. */
4 /*
6 @deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
8 Sets the first @var{count} bytes of @var{s} to the constant byte
9 @var{c}, returning a pointer to @var{s}.
11 @end deftypefn
15 #include <ansidecl.h>
16 #include <stddef.h>
18 PTR
19 memset (PTR dest, register int val, register size_t len)
21 register unsigned char *ptr = (unsigned char*)dest;
22 while (len-- > 0)
23 *ptr++ = val;
24 return dest;