mirror of
https://github.com/Ed94/Odin.git
synced 2026-07-29 02:40:05 +00:00
Make the string type elements "immutable", akin to char const * in C
Allows for extra security and optimization benefits
This commit is contained in:
+3
-1
@@ -282,5 +282,7 @@ compare_f64s :: proc(a, b: f64) -> int {
|
||||
return 0;
|
||||
}
|
||||
compare_strings :: proc(a, b: string) -> int {
|
||||
return mem.compare_byte_ptrs(&a[0], &b[0], min(len(a), len(b)));
|
||||
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));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user