mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-06 07:38:48 +00:00
Fix sort.compare_strings for prefixes
This commit is contained in:
+6
-1
@@ -684,5 +684,10 @@ compare_f64s :: proc(a, b: f64) -> int {
|
|||||||
compare_strings :: proc(a, b: string) -> int {
|
compare_strings :: proc(a, b: string) -> int {
|
||||||
x := transmute(mem.Raw_String)a
|
x := transmute(mem.Raw_String)a
|
||||||
y := transmute(mem.Raw_String)b
|
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