daily update
[binutils.git] / libiberty / memset.c
blob489ca1748157c034d17c376d7cf725c8c4ed784b
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 #ifdef __STDC__
17 #include <stddef.h>
18 #else
19 #define size_t unsigned long
20 #endif
22 PTR
23 DEFUN(memset, (dest, val, len),
24 PTR dest AND register int val AND register size_t len)
26 register unsigned char *ptr = (unsigned char*)dest;
27 while (len-- > 0)
28 *ptr++ = val;
29 return dest;