mirror of
https://github.com/italicsjenga/agb.git
synced 2024-12-24 00:31:34 +11:00
repr packed
This commit is contained in:
parent
4eaf8af72f
commit
496b4a4953
|
@ -1198,7 +1198,7 @@ enum ColourMode {
|
|||
/// This can be obtained from X/Y scale and rotation angle with
|
||||
/// [`agb::syscall::affine_matrix`].
|
||||
#[derive(Copy, Clone, Default, Debug, PartialEq, Eq)]
|
||||
#[repr(C)]
|
||||
#[repr(C, packed)]
|
||||
pub struct AffineMatrixAttributes {
|
||||
/// Adjustment made to *X* coordinate when drawing *horizontal* lines.
|
||||
/// Also known as "dx".
|
||||
|
|
|
@ -139,7 +139,7 @@ pub fn arc_tan2(x: i16, y: i32) -> i16 {
|
|||
result
|
||||
}
|
||||
|
||||
#[repr(C)]
|
||||
#[repr(C, packed)]
|
||||
pub struct BgAffineSetData {
|
||||
pub matrix: AffineMatrixAttributes,
|
||||
pub position: Vector2D<Num<i32, 8>>,
|
||||
|
@ -180,11 +180,12 @@ pub fn bg_affine_matrix(
|
|||
|
||||
unsafe {
|
||||
asm!(
|
||||
"swi {SWI}",
|
||||
SWI = const { swi_map(0x0E) },
|
||||
in("r0") &input as *const Input,
|
||||
in("r1") output.as_mut_ptr(),
|
||||
in("r2") 1,
|
||||
"swi {SWI}",
|
||||
SWI = const { swi_map(0x0E) },
|
||||
in("r0") &input as *const Input,
|
||||
in("r1") output.as_mut_ptr(),
|
||||
in("r2") 1,
|
||||
lateout("r3") _,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -235,7 +236,9 @@ mod tests {
|
|||
let one: Num<i16, 8> = 1.into();
|
||||
|
||||
let aff = obj_affine_matrix((one, one).into(), Num::default());
|
||||
assert_eq!(aff.p_a, one);
|
||||
assert_eq!(aff.p_d, one);
|
||||
let (p_a, p_d) = (aff.p_a, aff.p_d);
|
||||
|
||||
assert_eq!(p_a, one);
|
||||
assert_eq!(p_d, one);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue