diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2015-03-24 09:03:55 +0000 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2015-03-24 09:06:16 +0000 |
commit | 51809bd437c159fda9a753959361d208ff47228b (patch) | |
tree | df6b304d0d39acedb044dfa12a6fbec0b9ec2d53 /src/lcms2_internal.h | |
parent | f20b84fe595cfe27b8b10e84248d8c94e26f8d20 (diff) | |
download | lcms2-51809bd437c159fda9a753959361d208ff47228b.tar.gz |
Allow ptr alignment to be set at build time
At least some configurations of gcc on UltraSPARC require 8 byte alignment of
memory pointers (even on 32 bit user space, where sizeof(void *) == 4).
Rather than contaminate the source, provide ability to set the ptr alignment
on the compiler command line (on Unix, using CFLAGS when calling configure).
Diffstat (limited to 'src/lcms2_internal.h')
-rw-r--r-- | src/lcms2_internal.h | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/lcms2_internal.h b/src/lcms2_internal.h index 9fe91ad..1e46740 100644 --- a/src/lcms2_internal.h +++ b/src/lcms2_internal.h @@ -57,7 +57,15 @@ #define _cmsALIGNLONG(x) (((x)+(sizeof(cmsUInt32Number)-1)) & ~(sizeof(cmsUInt32Number)-1)) // Alignment to memory pointer -#define _cmsALIGNMEM(x) (((x)+(sizeof(void *) - 1)) & ~(sizeof(void *) - 1)) + +// (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)) // Maximum encodeable values in floating point #define MAX_ENCODEABLE_XYZ (1.0 + 32767.0/32768.0) |