1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-12 13:20:55 +00:00

StringLikeVariantOrder: Compare in-place

This commit is contained in:
rune-scape
2024-10-21 20:32:03 -07:00
parent fc827bbe25
commit 0c7d78f455
5 changed files with 60 additions and 28 deletions

View File

@@ -695,21 +695,13 @@ struct FileNoCaseComparator {
};
template <typename L, typename R>
_FORCE_INLINE_ bool is_str_less(const L *l_ptr, const R *r_ptr) {
_FORCE_INLINE_ int64_t str_compare(const L *l_ptr, const R *r_ptr) {
while (true) {
const char32_t l = *l_ptr;
const char32_t r = *r_ptr;
if (l == 0 && r == 0) {
return false;
} else if (l == 0) {
return true;
} else if (r == 0) {
return false;
} else if (l < r) {
return true;
} else if (l > r) {
return false;
if (l == 0 || l != r) {
return static_cast<int64_t>(l) - static_cast<int64_t>(r);
}
l_ptr++;