made str_equals faster

This commit is contained in:
Timerix 2025-08-10 17:21:55 +03:00
parent a097d5aff9
commit 8eeaff4245

View File

@ -14,12 +14,14 @@ str str_copy(str src){
bool str_equals(str s0, str s1){
if(s0.size != s1.size)
return false;
for(u32 i = 0; i < s0.size; i++)
if(s0.data[i] != s1.data[i])
return false;
return true;
/*
BENCHMARK:
str_equals64: 2.967s
strcmp: 4.143s
strncmp: 1.611s
memcmp: 0.710s
*/
return memcmp(s0.data, s1.data, s0.size) == 0;
}
str str_reverse(str s){