Use memcmp for str_eq

This commit is contained in:
gingerBill
2020-05-21 11:05:38 +01:00
parent 89d824216a
commit 0b16ed7c85

View File

@@ -170,12 +170,7 @@ GB_COMPARE_PROC(string_cmp_proc) {
gb_inline bool str_eq(String const &a, String const &b) {
if (a.len != b.len) return false;
for (isize i = 0; i < a.len; i++) {
if (a.text[i] != b.text[i]) {
return false;
}
}
return true;
return memcmp(a.text, b.text, a.len) == 0;
}
gb_inline bool str_ne(String const &a, String const &b) { return !str_eq(a, b); }
gb_inline bool str_lt(String const &a, String const &b) { return string_compare(a, b) < 0; }