summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-06-21 15:13:42 +0100
committerGravatar Michael Smith <mikesmiffy128@gmail.com> 2025-06-27 22:52:10 +0100
commita9f44f3a6cccdf147376f8bf010a85b334ed4c72 (patch)
tree8c6ba15bdef51bdf150a80b9dd2b1f7215b893d2
parentf38fc784ffab00c11b9818d18f55be34cc8aa130 (diff)
downloadsst-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...
-rw-r--r--src/wincrt.c17
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;