summaryrefslogtreecommitdiff
path: root/libiberty/memset.c
blob: 5f54831e83c468a62ecc2f59c90a50e8615a09f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/* memset
   This implementation is in the public domain.  */

#include <ansidecl.h>
#ifdef __STDC__
#include <stddef.h>
#else
#define size_t unsigned long
#endif

PTR
DEFUN(memset, (dest, val, len),
      PTR dest AND register int val AND register size_t len)
{
  register unsigned char *ptr = (unsigned char*)dest;
  while (len-- > 0)
    *ptr++ = val;
  return dest;
}