[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Finding the correct alignment for all architectures

I am maintaining lcms2. In #749975, I received a patch to ensure correct
alignment for doubles von MIPS. I have forwarded the patch upstream[1], but
in the latest release, upstream has chosen a different way. It is now
possible to configure the alignment via a preprocessor variable
// Alignment to memory pointer

// (Ultra)SPARC with gcc requires ptr alignment of 8 bytes
// even though sizeof(void *) is only four: for greatest flexibility
// allow the build to specify ptr alignment.
# define CMS_PTR_ALIGNMENT sizeof(void *)

#define _cmsALIGNMEM(x)  (((x)+(CMS_PTR_ALIGNMENT - 1)) & ~(CMS_PTR_ALIGNMENT - 1))

I would like to drop the Debian-specific patch. But what value for
CMS_PTR_ALIGNMENT would be good/sufficient on all arches?

[1] https://github.com/mm2/Little-CMS/issues/32
[2] https://github.com/mm2/Little-CMS/blob/master/src/lcms2_internal.h


Reply to: