diff --git a/core/sort/sort.odin b/core/sort/sort.odin index 2ce74294d..a2b4d7ea0 100644 --- a/core/sort/sort.odin +++ b/core/sort/sort.odin @@ -684,5 +684,10 @@ compare_f64s :: proc(a, b: f64) -> int { compare_strings :: proc(a, b: string) -> int { x := transmute(mem.Raw_String)a y := transmute(mem.Raw_String)b - return mem.compare_byte_ptrs(x.data, y.data, min(x.len, y.len)) + + ret := mem.compare_byte_ptrs(x.data, y.data, min(x.len, y.len)) + if ret == 0 && x.len != y.len { + return -1 if x.len < y.len else +1 + } + return ret }