Skip to content

Commit

Permalink
math: use extern struct for guaranteed memory layout
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Gutekanst <[email protected]>
  • Loading branch information
slimsag committed Sep 8, 2023
1 parent 0538698 commit 40a1ba0
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/math/mat.zig
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ pub fn Mat(
comptime n_rows: usize,
comptime Vector: type,
) type {
return struct {
return extern struct {
v: [cols]Vec,

/// The number of columns, e.g. Mat3x4.cols == 3
Expand Down
2 changes: 1 addition & 1 deletion src/math/quat.zig
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const math = mach.math;
const vec = @import("vec.zig");

pub fn Quat(comptime Scalar: type) type {
return struct {
return extern struct {
v: vec.Vec(4, Scalar),

/// The scalar type of this matrix, e.g. Mat3x3.T == f32
Expand Down
2 changes: 1 addition & 1 deletion src/math/vec.zig
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const testing = mach.testing;
const math = mach.math;

pub fn Vec(comptime n_value: usize, comptime Scalar: type) type {
return struct {
return extern struct {
v: Vector,

/// The vector dimension size, e.g. Vec3.n == 3
Expand Down

0 comments on commit 40a1ba0

Please sign in to comment.