aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorgingerBill <bill@gingerbill.org>2017-12-10 11:35:11 +0000
committergingerBill <bill@gingerbill.org>2017-12-10 11:35:11 +0000
commit3c6f90e5524d38bdd30750eb04441a1897bcd8dd (patch)
tree50dc37f196b7a2d0c40e1382950511654d1333a2 /core
parent3703ca4df47134e0c274cf5096d14c9323331ff0 (diff)
Fix proc groups from import names
Diffstat (limited to 'core')
-rw-r--r--core/_preload.odin6
-rw-r--r--core/math.odin4
-rw-r--r--core/raw.odin14
3 files changed, 18 insertions, 6 deletions
diff --git a/core/_preload.odin b/core/_preload.odin
index deb492161..6317c4a36 100644
--- a/core/_preload.odin
+++ b/core/_preload.odin
@@ -477,13 +477,13 @@ new_clone :: inline proc(data: $T, loc := #caller_location) -> ^T {
}
free_string :: proc(str: string, loc := #caller_location) {
- free_ptr((^raw.String)(&str).data, loc);
+ free_ptr(raw.data(str), loc);
}
free_dynamic_array :: proc(array: $T/[dynamic]$E, loc := #caller_location) {
- free_ptr((^raw.Dynamic_Array)(&array).data, loc);
+ free_ptr(raw.data(array), loc);
}
free_slice :: proc(array: $T/[]$E, loc := #caller_location) {
- free_ptr((^raw.Slice)(&array).data, loc);
+ free_ptr(raw.data(array), loc);
}
free_map :: proc(m: $T/map[$K]$V, loc := #caller_location) {
raw := cast(^raw.Map)&m;
diff --git a/core/math.odin b/core/math.odin
index 3c66575fc..6f72ce631 100644
--- a/core/math.odin
+++ b/core/math.odin
@@ -399,11 +399,11 @@ quat_mulf :: proc(q: Quat, f: f32) -> Quat { return Quat{q.x*f, q.y*f, q.z*f, q.
quat_divf :: proc(q: Quat, f: f32) -> Quat { return Quat{q.x/f, q.y/f, q.z/f, q.w/f}; }
quat_div :: proc(q0, q1: Quat) -> Quat { return mul(q0, quat_inverse(q1)); }
-quat_inverse :: proc(q: Quat) -> Quat { return div(conj(q), quat_dot(q, q)); }
+quat_inverse :: proc(q: Quat) -> Quat { return div(conj(q), dot(q, q)); }
quat_dot :: proc(q0, q1: Quat) -> f32 { return q0.x*q1.x + q0.y*q1.y + q0.z*q1.z + q0.w*q1.w; }
quat_norm :: proc(q: Quat) -> Quat {
- m := sqrt(quat_dot(q, q));
+ m := sqrt(dot(q, q));
return div(q, m);
}
diff --git a/core/raw.odin b/core/raw.odin
index d044e1114..a8184026e 100644
--- a/core/raw.odin
+++ b/core/raw.odin
@@ -4,7 +4,7 @@ Any :: struct #ordered {
}
String :: struct #ordered {
- data: ^u8,
+ data: ^byte,
len: int,
}
@@ -25,3 +25,15 @@ Map :: struct #ordered {
entries: Dynamic_Array,
}
+string_data :: inline proc(s: $T/string) -> ^byte {
+ return (^String)(&s).data;
+}
+
+slice_data :: inline proc(a: $T/[]$E) -> ^E {
+ return cast(^E)(^Slice)(&a).data;
+}
+dynamic_array_data :: inline proc(a: $T/[dynamic]$E) -> ^E {
+ return cast(^E)(^Dynamic_Array)(&a).data;
+}
+
+data :: proc[string_data, slice_data, dynamic_array_data];