From 24d4c6973eb6e735d093737398645c51dce12a68 Mon Sep 17 00:00:00 2001 From: Nicole LeGare Date: Wed, 24 Apr 2024 10:31:03 -0700 Subject: [PATCH] Code review cleanup --- src/internal.rs | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/internal.rs b/src/internal.rs index d3c1b14aa..fd644e34b 100644 --- a/src/internal.rs +++ b/src/internal.rs @@ -931,7 +931,7 @@ impl BitDepthDependentType for AlPal { type T = [[[[BD::Pixel; 8]; 3]; 32]; 2]; /* [2 a/l][32 bx/y4][3 plane][8 palette_idx] */ } -#[derive(Clone, Copy, FromZeroes, FromBytes, AsBytes)] +#[derive(FromZeroes, FromBytes, AsBytes)] #[repr(C, align(64))] pub struct ScratchCompinter { pub compinter: [[i16; 16384]; 2], @@ -941,7 +941,7 @@ pub struct ScratchCompinter { // Larger of the two between `ScratchCompinter` and `[BD::Pixel; 128 * 32]`. const SCRATCH_COMPINTER_SIZE: usize = mem::size_of::(); -#[derive(Clone, Copy, FromZeroes, FromBytes, AsBytes)] +#[derive(FromZeroes, FromBytes, AsBytes)] #[repr(C, align(64))] pub struct ScratchLapInter([u8; SCRATCH_COMPINTER_SIZE]); @@ -957,7 +957,7 @@ impl ScratchLapInter { const EMU_EDGE_LEN: usize = 320 * (256 + 7); // stride=192 for non-SVC, or 320 for SVC -#[derive(Clone, Copy, FromZeroes, FromBytes, AsBytes)] +#[derive(FromZeroes, FromBytes, AsBytes)] #[repr(C, align(32))] pub struct ScratchEmuEdge([u8; EMU_EDGE_LEN * 2]); @@ -967,21 +967,21 @@ impl ScratchEmuEdge { } } -#[derive(Clone, Copy, FromZeroes, FromBytes, AsBytes)] +#[derive(FromZeroes, FromBytes, AsBytes)] #[repr(C)] pub struct ScratchInter { pub lap_inter: ScratchLapInter, pub emu_edge: ScratchEmuEdge, } -#[derive(Clone, Copy, FromZeroes, FromBytes, AsBytes)] +#[derive(FromZeroes, FromBytes, AsBytes)] #[repr(C, align(64))] pub struct ScratchPal { pub pal_order: [[u8; 8]; 64], pub pal_ctx: [u8; 64], } -#[derive(Clone, Copy, FromZeroes, FromBytes, AsBytes)] +#[derive(FromZeroes, FromBytes, AsBytes)] #[repr(C, align(64))] pub struct ScratchLevelsPal([u8; 1088]); @@ -991,7 +991,7 @@ impl ScratchLevelsPal { } pub fn pal_mut(&mut self) -> &mut ScratchPal { - ScratchPal::mut_from_prefix(&mut self.0).unwrap() + FromBytes::mut_from_prefix(&mut self.0).unwrap() } } @@ -1016,7 +1016,7 @@ impl ScratchEdgeBuf { } #[derive(Clone, Copy, FromZeroes, FromBytes, AsBytes)] -#[repr(C, align(16))] +#[repr(C, align(16))] // Over-aligned for 8bpc (needs to be `align(8)` for 8bpc, `align(16)` for 16bpc). pub struct ScratchPalBuf([u8; 8 * 3 * 2]); /* [3 plane][8 palette_idx] */ impl ScratchPalBuf { @@ -1035,6 +1035,8 @@ pub struct ScratchInterintraEdgePal { pub interintra: ScratchInterintraBuf, pub edge: ScratchEdgeBuf, pub pal: ScratchPalBuf, + + /// For `AsBytes`, so there's no implicit padding. _padding: [u8; 48], } @@ -1056,7 +1058,7 @@ impl ScratchAcTxtpMap { } } -#[derive(Clone, Copy, FromZeroes, FromBytes, AsBytes)] +#[derive(FromZeroes, FromBytes, AsBytes)] #[repr(C)] pub struct ScratchInterIntra { pub levels_pal: ScratchLevelsPal,