mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-09 03:54:22 +00:00
Fix sort.compare_strings for prefixes
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user