From 8d4b47298b6c9eeb9a3f79a5b80d894f80ed4a45 Mon Sep 17 00:00:00 2001 From: Michael Smith Date: Sat, 27 Dec 2025 03:05:05 +0000 Subject: Do away with memcpy/memset/memcmp Now everything is either explicitly a rep thing, or explicitly some other small run of reasonably efficient instructions. No library calls or function call overhead of any kind. Code size remains nice and small. Ban a few other bad libc functions while we're at it. More can be added later if we decide that's a useful idea. This will require some discipline and workarounds to cope with Clang's tendency to shove mem* calls in places you don't want them even when you tell it not to. Well, c'est la vie. I'm a little nervous that the __builtin_memmove() usage in shuntvars() could still one day emit actual library calls. It appears we're not importing memmove() from anywhere at the moment, though. So I guess it's good enough for now. Also I had to get rid of alloca() in con_.c but that was kind of bad anyway, so that's fine. --- src/gameinfo.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gameinfo.c') diff --git a/src/gameinfo.c b/src/gameinfo.c index 877ca2a..efa1c2c 100644 --- a/src/gameinfo.c +++ b/src/gameinfo.c @@ -14,7 +14,6 @@ * PERFORMANCE OF THIS SOFTWARE. */ -#include #ifdef _WIN32 #include // MultiByteToWideChar() #endif @@ -24,6 +23,7 @@ #include "gamedata.h" #include "gametype.h" #include "langext.h" +#include "mem.h" #include "os.h" #include "vcall.h" @@ -77,10 +77,10 @@ bool gameinfo_init() { int len = GetWindowTextA(gamewin, title, ssizeof(title)); // argh, why did they start doing this, it's so pointless! // hopefully nobody included these suffixes in their mod names, lol - if (len > 13 && !memcmp(title + len - 13, " - Direct3D 9", 13)) { + if (len > 13 && !mem_cmp(title + len - 13, " - Direct3D 9", 13)) { title[len - 13] = '\0'; } - else if (len > 9 && !memcmp(title + len - 9, " - Vulkan", 9)) { + else if (len > 9 && !mem_cmp(title + len - 9, " - Vulkan", 9)) { title[len - 9] = '\0'; } #else -- cgit v1.2.3-54-g00ecf