fix tail comparisons

This commit is contained in:
Nikita Smith
2026-06-19 20:12:25 -07:00
committed by Ryan Fleury
parent c81c072018
commit 6ea9bfc5a3
2 changed files with 53 additions and 42 deletions
+4 -2
View File
@@ -3,8 +3,9 @@
////////////////////////////////
#if !defined(MEM_STATIC)
#ifndef MEM_STATIC
# define MEM_STATIC
# define MEM_API ASAN_NO_ADDR static inline
# include "third_party/martins_memfun/memfun.h"
#endif
@@ -281,7 +282,7 @@ str8_match(String8 a, String8 b, StringMatchFlags flags)
{
result = MemIsEqual(a.str, b.str, b.size);
}
else if(a.size == b.size && flags == StringMatchFlag_CaseInsensitive)
else if (a.size == b.size && flags == StringMatchFlag_CaseInsensitive)
{
result = MemCompareI(a.str, b.str, a.size) == 0;
}
@@ -3087,6 +3088,7 @@ str8_compar(String8 a, String8 b, B32 ignore_case)
else
{
cmp = MemCompare(a.str, b.str, size);
cmp = cmp > 0 ? 1 : cmp < 0 ? -1 : 0;
}
// shorter prefix must precede longer prefixes