Finding the correct alignment for all architectures
Hi,
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
CMS_PTR_ALIGNMENT[2]:
// 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.
#ifndef CMS_PTR_ALIGNMENT
# define CMS_PTR_ALIGNMENT sizeof(void *)
#endif
#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
Thanks
Thomas
Reply to: