Back to index

cell-binutils  2.17cvs20070401
memset.c
Go to the documentation of this file.
00001 /* memset
00002    This implementation is in the public domain.  */
00003 
00004 /*
00005 
00006 @deftypefn Supplemental void* memset (void *@var{s}, int @var{c}, size_t @var{count})
00007 
00008 Sets the first @var{count} bytes of @var{s} to the constant byte
00009 @var{c}, returning a pointer to @var{s}.
00010 
00011 @end deftypefn
00012 
00013 */
00014 
00015 #include <ansidecl.h>
00016 #include <stddef.h>
00017 
00018 PTR
00019 memset (PTR dest, register int val, register size_t len)
00020 {
00021   register unsigned char *ptr = (unsigned char*)dest;
00022   while (len-- > 0)
00023     *ptr++ = val;
00024   return dest;
00025 }