diff options
| author | gingerBill <bill@gingerbill.org> | 2022-08-05 11:36:20 +0100 |
|---|---|---|
| committer | gingerBill <bill@gingerbill.org> | 2022-08-05 11:36:20 +0100 |
| commit | 64ff05303c898a4217ed85a527f24ef569f1e6e7 (patch) | |
| tree | 17f094a2a5b63822a7e1c5ce95fcdc1a76a05df3 /core/runtime | |
| parent | 6caab6225da912be51cbce5e6498490e6dcba06b (diff) | |
| parent | 326411498a3e252133b39e0b59d2c0dc711b451e (diff) | |
Merge branch 'master' of https://github.com/odin-lang/Odin
Diffstat (limited to 'core/runtime')
| -rw-r--r-- | core/runtime/internal.odin | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/core/runtime/internal.odin b/core/runtime/internal.odin index 30798f623..16af84ebc 100644 --- a/core/runtime/internal.odin +++ b/core/runtime/internal.odin @@ -341,7 +341,12 @@ string_eq :: proc "contextless" (lhs, rhs: string) -> bool { string_cmp :: proc "contextless" (a, b: string) -> int { x := transmute(Raw_String)a y := transmute(Raw_String)b - return memory_compare(x.data, y.data, min(x.len, y.len)) + + ret := memory_compare(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 } string_ne :: #force_inline proc "contextless" (a, b: string) -> bool { return !string_eq(a, b) } |