Skip to content

Commit

Permalink
fix: 32 bits architecture crash
Browse files Browse the repository at this point in the history
When using imagequant on 32 bit env I had this bug:
crossbeam expects pointers (data) to be aligned on 16 bits (because of this repr(C, align(16)))
  • Loading branch information
erwanvivien committed Mar 8, 2023
1 parent 9f15d1c commit 4d8c166
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/pal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,10 @@ pub const MAX_TRANSP_A: f32 = 255. / 256. * LIQ_WEIGHT_A;
///
/// ARGB layout is important for x86 SIMD.
/// I've created the newtype wrapper to try a 16-byte alignment, but it didn't improve perf :(
#[repr(C, align(16))]
#[cfg_attr(
any(target_arch = "x86_64", all(target_feature = "neon", target_arch = "aarch64")),
repr(C, align(16))
)]
#[derive(Debug, Copy, Clone, Default, PartialEq)]
#[allow(non_camel_case_types)]
pub struct f_pixel(pub ARGBF);
Expand Down

0 comments on commit 4d8c166

Please sign in to comment.