* ld-selective/3.cc (start): New function.
[binutils.git] / libiberty / memset.c
blob5119f858ad067c1b834a2f00772fa3894602c69f
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 ANSI_PROTOTYPES
17 #include <stddef.h>
18 #else
19 #define size_t unsigned long
20 #endif
22 PTR
23 memset (dest, val, len)
24 PTR dest;
25 register int val;
26 register size_t len;
28 register unsigned char *ptr = (unsigned char*)dest;
29 while (len-- > 0)
30 *ptr++ = val;
31 return dest;