From c38d38e89d8eaa5a9b98d9648a7b60e86d498bd6 Mon Sep 17 00:00:00 2001 From: Alexander Date: Tue, 5 Aug 2025 13:04:30 +0300 Subject: [PATCH] Align `Color32` to 4 bytes (#7318) It could be useful when you want to preprocess an image using SIMD instructions without extra copying to convert it to a texture. Possibly we might add it as a feature. * Closes * [x] I have followed the instructions in the PR template Co-authored-by: Emil Ernerfeldt --- crates/ecolor/src/color32.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/crates/ecolor/src/color32.rs b/crates/ecolor/src/color32.rs index eaa1ce2c..e7372070 100644 --- a/crates/ecolor/src/color32.rs +++ b/crates/ecolor/src/color32.rs @@ -24,6 +24,7 @@ use crate::{Rgba, fast_round, linear_f32_from_linear_u8}; /// /// An `alpha=0` means the color is to be treated as an additive color. #[repr(C)] +#[repr(align(4))] #[derive(Clone, Copy, Default, Eq, Hash, PartialEq)] #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[cfg_attr(feature = "bytemuck", derive(bytemuck::Pod, bytemuck::Zeroable))]