diff options
author | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
---|---|---|
committer | Adam <you@example.com> | 2020-05-17 05:51:50 +0200 |
commit | e611b132f9b8abe35b362e5870b74bce94a1e58e (patch) | |
tree | a5781d2ec0e085eeca33cf350cf878f2efea6fe5 /private/crt32/string/memset.c | |
download | NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.gz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.bz2 NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.lz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.xz NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.tar.zst NT4.0-e611b132f9b8abe35b362e5870b74bce94a1e58e.zip |
Diffstat (limited to 'private/crt32/string/memset.c')
-rw-r--r-- | private/crt32/string/memset.c | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/private/crt32/string/memset.c b/private/crt32/string/memset.c new file mode 100644 index 000000000..5a04554a9 --- /dev/null +++ b/private/crt32/string/memset.c @@ -0,0 +1,70 @@ +/*** +*memset.c - set a section of memory to all one byte +* +* Copyright (c) 1988-1991, Microsoft Corporation. All rights reserved. +* +*Purpose: +* contains the memset() routine +* +*Revision History: +* 05-31-89 JCR C version created. +* 02-27-90 GJF Fixed calling type, #include <cruntime.h>, fixed +* copyright. +* 08-14-90 SBM Compiles cleanly with -W3 +* 10-01-90 GJF New-style function declarator. Also, rewrote expr. to +* avoid using cast as an lvalue. +* 04-01-91 SRW Add #pragma function for i386 _WIN32_ and _CRUISER_ +* builds +* 07-16-93 SRW ALPHA Merge +* +*******************************************************************************/ + +#include <cruntime.h> +#include <string.h> + +#ifdef _MSC_VER +#pragma function(memset) +#endif + +/*** +*char *memset(dst, val, count) - sets "count" bytes at "dst" to "val" +* +*Purpose: +* Sets the first "count" bytes of the memory starting +* at "dst" to the character value "val". +* +*Entry: +* void *dst - pointer to memory to fill with val +* int val - value to put in dst bytes +* size_t count - number of bytes of dst to fill +* +*Exit: +* returns dst, with filled bytes +* +*Exceptions: +* +*******************************************************************************/ + +void * _CALLTYPE1 memset ( + void *dst, + int val, + size_t count + ) +{ + void *start = dst; + +#if defined(_M_MRX000) || defined(_M_ALPHA) || defined(_M_PPC) + { + extern void RtlFillMemory( void *, size_t count, char ); + + RtlFillMemory( dst, count, (char)val ); + } +#else + while (count--) { + *(char *)dst = (char)val; + dst = (char *)dst + 1; + } +#endif + + return(start); +} |