diff --git a/src/structs/mat.rs b/src/structs/mat.rs index 5def5f5b..493250ff 100644 --- a/src/structs/mat.rs +++ b/src/structs/mat.rs @@ -21,6 +21,7 @@ use quickcheck::{Arbitrary, Gen}; /// Special identity matrix. All its operation are no-ops. +#[repr(C)] #[derive(Eq, PartialEq, RustcDecodable, Clone, Debug, Copy)] pub struct Identity; @@ -33,6 +34,7 @@ impl Identity { } /// Square matrix of dimension 1. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Mat1 { pub m11: N @@ -79,6 +81,7 @@ arbitrary_impl!(Mat1, m11); rand_impl!(Mat1, m11); /// Square matrix of dimension 2. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Mat2 { pub m11: N, pub m21: N, @@ -129,6 +132,7 @@ arbitrary_impl!(Mat2, m11, m12, m21, m22); rand_impl!(Mat2, m11, m12, m21, m22); /// Square matrix of dimension 3. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Mat3 { pub m11: N, pub m21: N, pub m31: N, @@ -221,6 +225,7 @@ rand_impl!(Mat3, ); /// Square matrix of dimension 4. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Mat4 { pub m11: N, pub m21: N, pub m31: N, pub m41: N, @@ -333,6 +338,7 @@ rand_impl!(Mat4, ); /// Square matrix of dimension 5. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Mat5 { pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N, @@ -461,6 +467,7 @@ rand_impl!(Mat5, ); /// Square matrix of dimension 6. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Mat6 { pub m11: N, pub m21: N, pub m31: N, pub m41: N, pub m51: N, pub m61: N, diff --git a/src/structs/pnt.rs b/src/structs/pnt.rs index 4dfde695..cca26e5d 100644 --- a/src/structs/pnt.rs +++ b/src/structs/pnt.rs @@ -19,6 +19,7 @@ use quickcheck::{Arbitrary, Gen}; /// Point of dimension 0. +#[repr(C)] #[derive(Eq, PartialEq, Clone, Debug, Copy)] pub struct Pnt0(pub PhantomData); @@ -37,6 +38,7 @@ impl Pnt0 { } /// Point of dimension 1. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Pnt1 { /// First component of the point. @@ -77,6 +79,7 @@ arbitrary_pnt_impl!(Pnt1, x); rand_impl!(Pnt1, x); /// Point of dimension 2. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Pnt2 { /// First component of the point. @@ -119,6 +122,7 @@ arbitrary_pnt_impl!(Pnt2, x, y); rand_impl!(Pnt2, x, y); /// Point of dimension 3. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Pnt3 { /// First component of the point. @@ -163,6 +167,7 @@ arbitrary_pnt_impl!(Pnt3, x, y, z); rand_impl!(Pnt3, x, y, z); /// Point of dimension 4. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Pnt4 { /// First component of the point. @@ -209,6 +214,7 @@ arbitrary_pnt_impl!(Pnt4, x, y, z, w); rand_impl!(Pnt4, x, y, z, w); /// Point of dimension 5. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Pnt5 { /// First component of the point. @@ -257,6 +263,7 @@ arbitrary_pnt_impl!(Pnt5, x, y, z, w, a); rand_impl!(Pnt5, x, y, z, w, a); /// Point of dimension 6. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Pnt6 { /// First component of the point. diff --git a/src/structs/quat.rs b/src/structs/quat.rs index 98afa714..509c42f1 100644 --- a/src/structs/quat.rs +++ b/src/structs/quat.rs @@ -20,6 +20,7 @@ use quickcheck::{Arbitrary, Gen}; /// A quaternion. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Quat { /// The scalar component of the quaternion. @@ -158,6 +159,7 @@ impl + BaseFloat> Div> for Quat { /// A unit quaternion that can represent a 3D rotation. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct UnitQuat { q: Quat diff --git a/src/structs/vec.rs b/src/structs/vec.rs index f8a52c00..be3cf7f2 100644 --- a/src/structs/vec.rs +++ b/src/structs/vec.rs @@ -21,6 +21,7 @@ use quickcheck::{Arbitrary, Gen}; /// Vector of dimension 0. +#[repr(C)] #[derive(Eq, PartialEq, Clone, Debug, Copy)] pub struct Vec0(pub PhantomData); @@ -39,6 +40,7 @@ impl Vec0 { } /// Vector of dimension 1. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Vec1 { /// First component of the vector. @@ -90,6 +92,7 @@ arbitrary_impl!(Vec1, x); rand_impl!(Vec1, x); /// Vector of dimension 2. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Vec2 { /// First component of the vector. @@ -143,6 +146,7 @@ arbitrary_impl!(Vec2, x, y); rand_impl!(Vec2, x, y); /// Vector of dimension 3. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Vec3 { /// First component of the vector. @@ -199,6 +203,7 @@ rand_impl!(Vec3, x, y, z); /// Vector of dimension 4. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Vec4 { /// First component of the vector. @@ -256,6 +261,7 @@ arbitrary_impl!(Vec4, x, y, z, w); rand_impl!(Vec4, x, y, z, w); /// Vector of dimension 5. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Vec5 { /// First component of the vector. @@ -315,6 +321,7 @@ arbitrary_impl!(Vec5, x, y, z, w, a); rand_impl!(Vec5, x, y, z, w, a); /// Vector of dimension 6. +#[repr(C)] #[derive(Eq, PartialEq, RustcEncodable, RustcDecodable, Clone, Hash, Debug, Copy)] pub struct Vec6 { /// First component of the vector.