mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 07:08:48 +00:00
Best viable overloading procedure algorithm; no_alias; call expr style casts
This commit is contained in:
+2
-2
@@ -297,11 +297,11 @@ __string_eq :: proc(a, b: string) -> bool {
|
||||
if a.data == b.data {
|
||||
return true;
|
||||
}
|
||||
return mem.compare(a.data, b.data, a.count) == 0;
|
||||
return mem.compare(a.data as rawptr, b.data as rawptr, a.count) == 0;
|
||||
}
|
||||
|
||||
__string_cmp :: proc(a, b: string) -> int {
|
||||
return mem.compare(a.data, b.data, min(a.count, b.count));
|
||||
return mem.compare(a.data as rawptr, b.data as rawptr, min(a.count, b.count));
|
||||
}
|
||||
|
||||
__string_ne :: proc(a, b: string) -> bool #inline { return !__string_eq(a, b); }
|
||||
|
||||
+7
-7
@@ -236,7 +236,7 @@ bprint :: proc(buf: ^Buffer, args: ...any) -> int {
|
||||
if i > 0 && !is_string && !prev_string {
|
||||
buffer_write_rune(buf, ' ');
|
||||
}
|
||||
fmt_value(^fi, arg, 'v');
|
||||
fmt_value(^fi, args[i], 'v');
|
||||
prev_string = is_string;
|
||||
}
|
||||
return buf.length;
|
||||
@@ -250,7 +250,7 @@ bprintln :: proc(buf: ^Buffer, args: ...any) -> int {
|
||||
if i > 0 {
|
||||
buffer_write_rune(buf, ' ');
|
||||
}
|
||||
fmt_value(^fi, arg, 'v');
|
||||
fmt_value(^fi, args[i], 'v');
|
||||
}
|
||||
buffer_write_rune(buf, '\n');
|
||||
return buf.length;
|
||||
@@ -967,16 +967,16 @@ fmt_enum :: proc(fi: ^Fmt_Info, v: any, verb: rune) {
|
||||
}
|
||||
|
||||
if is_type_integer(e.base) {
|
||||
for val, idx : e.values {
|
||||
if val.i == i {
|
||||
for it, idx : e.values {
|
||||
if it.i == i {
|
||||
buffer_write_string(fi.buf, e.names[idx]);
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for val, idx : e.values {
|
||||
if val.f == f {
|
||||
for it, idx : e.values {
|
||||
if it.f == f {
|
||||
buffer_write_string(fi.buf, e.names[idx]);
|
||||
ok = true;
|
||||
break;
|
||||
@@ -1312,7 +1312,7 @@ bprintf :: proc(b: ^Buffer, fmt: string, args: ...any) -> int {
|
||||
if arg.data == nil || arg.type_info == nil {
|
||||
buffer_write_string(b, "<nil>");
|
||||
} else {
|
||||
fmt_arg(^fi, arg, 'v');
|
||||
fmt_arg(^fi, args[index], 'v');
|
||||
}
|
||||
}
|
||||
buffer_write_string(b, ")");
|
||||
|
||||
+1
-1
@@ -166,7 +166,7 @@ mul :: proc(a, b: Mat4) -> Mat4 {
|
||||
return c;
|
||||
}
|
||||
|
||||
mul_vec4 :: proc(m: Mat4, v: Vec4) -> Vec4 {
|
||||
mul :: proc(m: Mat4, v: Vec4) -> Vec4 {
|
||||
return Vec4{
|
||||
m[0][0]*v.x + m[1][0]*v.y + m[2][0]*v.z + m[3][0]*v.w,
|
||||
m[0][1]*v.x + m[1][1]*v.y + m[2][1]*v.z + m[3][1]*v.w,
|
||||
|
||||
Reference in New Issue
Block a user