From 7bc1704d6a28b691aed4f97408f851baa16f9b9d Mon Sep 17 00:00:00 2001 From: jeefo Date: Mon, 26 Jun 2023 10:28:01 +0300 Subject: [PATCH] bot: revert simd-string changes --- ext/crlib | 2 +- inc/practice.h | 2 +- src/engine.cpp | 4 ++-- src/graph.cpp | 2 +- src/linkage.cpp | 9 +++------ src/storage.cpp | 2 +- src/support.cpp | 2 +- 7 files changed, 10 insertions(+), 13 deletions(-) diff --git a/ext/crlib b/ext/crlib index 3e1b576..99c8383 160000 --- a/ext/crlib +++ b/ext/crlib @@ -1 +1 @@ -Subproject commit 3e1b576f85c56a1909cb49008b1b23135b390edb +Subproject commit 99c8383ae2fccd6b0263bef92a154e571a0de12d diff --git a/inc/practice.h b/inc/practice.h index 57f2579..bdf2ade 100644 --- a/inc/practice.h +++ b/inc/practice.h @@ -27,7 +27,7 @@ public: public: constexpr bool operator == (const DangerStorage &rhs) const { - return cr::memcmp (rhs.data, data, sizeof (data)); + return rhs.data[2] == data[2] && rhs.data[1] == data[1] && rhs.data[0] == data[0]; } constexpr bool operator != (const DangerStorage &rhs) const { diff --git a/src/engine.cpp b/src/engine.cpp index 8d8e7ea..eab114b 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -288,7 +288,7 @@ public: } bool isWave (char *format) { - if (little && cr::memcmp (format, "WAVE", 4) == 0) { + if (little && memcmp (format, "WAVE", 4) == 0) { return true; } return *reinterpret_cast (format) == 0x57415645; @@ -1174,7 +1174,7 @@ void LightMeasure::updateLight (int style, char *value) { strings.copy (m_lightstyle[style].map, value, copyLimit); m_lightstyle[style].map[copyLimit] = kNullChar; - m_lightstyle[style].length = static_cast (cr::strlen (m_lightstyle[style].map)); + m_lightstyle[style].length = static_cast (strlen (m_lightstyle[style].map)); } template bool LightMeasure::recursiveLightPoint (const M *node, const Vector &start, const Vector &end) { diff --git a/src/graph.cpp b/src/graph.cpp index bc5e5ee..8e12129 100644 --- a/src/graph.cpp +++ b/src/graph.cpp @@ -1501,7 +1501,7 @@ bool BotGraph::convertOldFormat () { return false; } - if (cr::strncmp (header.header, kPodbotMagic, cr::bufsize (kPodbotMagic)) == 0) { + if (strncmp (header.header, kPodbotMagic, cr::bufsize (kPodbotMagic)) == 0) { if (header.fileVersion != StorageVersion::Podbot) { return false; } diff --git a/src/linkage.cpp b/src/linkage.cpp index da15130..b3f9600 100644 --- a/src/linkage.cpp +++ b/src/linkage.cpp @@ -148,7 +148,7 @@ CR_EXPORT int GetEntityAPI (gamefuncs_t *table, int) { // the server for incoming clients. // check if this client is the listen server client - if (cr::strcmp (addr, "loopback") == 0) { + if (strcmp (addr, "loopback") == 0) { game.setLocalEntity (ent); // save the edict of the listen server client... // if not dedicated set the default editor for graph @@ -466,7 +466,7 @@ CR_LINKAGE_C int GetEngineFunctions (enginefuncs_t *table, int *) { if (game.is (GameFlags::Legacy)) { table->pfnFindEntityByString = [] (edict_t *edictStartSearchAfter, const char *field, const char *value) { // round starts in counter-strike 1.5 - if (cr::strcmp (value, "info_map_parameters") == 0) { + if (strcmp (value, "info_map_parameters") == 0) { bots.initRound (); } @@ -885,9 +885,6 @@ DLL_GIVEFNPTRSTODLL GiveFnptrsToDll (enginefuncs_t *table, globalvars_t *glob) { // such if necessary. Nothing really bot-related is done in this function. The actual bot // initialization stuff will be done later, when we'll be certain to have a multilayer game. - // initialize simd-string functions - simdstring.init (); - // get the engine functions from the game... memcpy (&engfuncs, table, sizeof (enginefuncs_t)); globals = glob; @@ -965,7 +962,7 @@ SharedLibrary::Func EntityLinkage::lookup (SharedLibrary::Handle module, const c return m_dlsym (handle, function); }; - if (ents.needsBypass () && !cr::strcmp (function, "CreateInterface")) { + if (ents.needsBypass () && !strcmp (function, "CreateInterface")) { ents.setPaused (true); auto ret = resolve (module); diff --git a/src/storage.cpp b/src/storage.cpp index 85d831c..1b95aea 100644 --- a/src/storage.cpp +++ b/src/storage.cpp @@ -166,7 +166,7 @@ template bool BotStorage::load (SmallArray &data, ExtenHeader * if (extenSize <= actuallyRead) { // write modified by, only if the name is different - if (!strings.isEmpty (extenHeader.author) && cr::strncmp (extenHeader.author, exten->modified, cr::bufsize (extenHeader.author)) != 0) { + if (!strings.isEmpty (extenHeader.author) && strncmp (extenHeader.author, exten->modified, cr::bufsize (extenHeader.author)) != 0) { strings.copy (extenHeader.modified, exten->modified, cr::bufsize (exten->modified)); } } diff --git a/src/support.cpp b/src/support.cpp index c96aabe..344600e 100644 --- a/src/support.cpp +++ b/src/support.cpp @@ -584,7 +584,7 @@ int32_t BotSupport::sendTo (int socket, const void *message, size_t length, int constexpr int32_t packetLength = 5; // player replies response - if (length > packetLength && cr::memcmp (packet, "\xff\xff\xff\xff", packetLength - 1) == 0) { + if (length > packetLength && memcmp (packet, "\xff\xff\xff\xff", packetLength - 1) == 0) { if (packet[4] == 'D') { QueryBuffer buffer { packet, length, packetLength }; auto count = buffer.read ();