diff options
author | 2025-06-21 15:13:42 +0100 | |
---|---|---|
committer | 2025-06-27 22:52:10 +0100 | |
commit | a9f44f3a6cccdf147376f8bf010a85b334ed4c72 (patch) | |
tree | 8c6ba15bdef51bdf150a80b9dd2b1f7215b893d2 /src | |
parent | f38fc784ffab00c11b9818d18f55be34cc8aa130 (diff) | |
download | sst-a9f44f3a6cccdf147376f8bf010a85b334ed4c72.tar.gz sst-a9f44f3a6cccdf147376f8bf010a85b334ed4c72.zip |
Add memset to wincrt.c
The code I'm about to commit appears to generate a call to this. Funny
we never needed it until now...
Diffstat (limited to 'src')
-rw-r--r-- | src/wincrt.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/wincrt.c b/src/wincrt.c index ced1203..d8111ba 100644 --- a/src/wincrt.c +++ b/src/wincrt.c @@ -48,6 +48,23 @@ void *memcpy(void *restrict x, const void *restrict y, unsigned int sz) { #endif } +void *memset(void *x, int c, unsigned int sz) { +#if defined(__GNUC__) || defined(__clang__) + void *r = x; + __asm__ volatile ( + "rep stosb\n" + : "+D" (x), "+c" (sz) + : "a"(c) + : "memory" + ); + return r; +#else + const unsigned char *xb = x; + for (unsigned int i = 0; i < len; ++i) xb[i] = (unsigned char)c; + return x; +#endif +} + int __stdcall _DllMainCRTStartup(void *inst, unsigned int reason, void *reserved) { return 1; |