math: use extern struct for guaranteed memory layout
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
0538698bda
commit
40a1ba0431
3 changed files with 3 additions and 3 deletions
|
|
@ -10,7 +10,7 @@ pub fn Mat(
|
||||||
comptime n_rows: usize,
|
comptime n_rows: usize,
|
||||||
comptime Vector: type,
|
comptime Vector: type,
|
||||||
) type {
|
) type {
|
||||||
return struct {
|
return extern struct {
|
||||||
v: [cols]Vec,
|
v: [cols]Vec,
|
||||||
|
|
||||||
/// The number of columns, e.g. Mat3x4.cols == 3
|
/// The number of columns, e.g. Mat3x4.cols == 3
|
||||||
|
|
|
||||||
|
|
@ -6,7 +6,7 @@ const math = mach.math;
|
||||||
const vec = @import("vec.zig");
|
const vec = @import("vec.zig");
|
||||||
|
|
||||||
pub fn Quat(comptime Scalar: type) type {
|
pub fn Quat(comptime Scalar: type) type {
|
||||||
return struct {
|
return extern struct {
|
||||||
v: vec.Vec(4, Scalar),
|
v: vec.Vec(4, Scalar),
|
||||||
|
|
||||||
/// The scalar type of this matrix, e.g. Mat3x3.T == f32
|
/// The scalar type of this matrix, e.g. Mat3x3.T == f32
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ const testing = mach.testing;
|
||||||
const math = mach.math;
|
const math = mach.math;
|
||||||
|
|
||||||
pub fn Vec(comptime n_value: usize, comptime Scalar: type) type {
|
pub fn Vec(comptime n_value: usize, comptime Scalar: type) type {
|
||||||
return struct {
|
return extern struct {
|
||||||
v: Vector,
|
v: Vector,
|
||||||
|
|
||||||
/// The vector dimension size, e.g. Vec3.n == 3
|
/// The vector dimension size, e.g. Vec3.n == 3
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue