[PATCH] dix: Really align valuators on doubles.
Keith Packard
keithp at keithp.com
Wed May 18 00:45:05 PDT 2011
On Wed, 18 May 2011 13:30:44 +1000, Peter Hutterer <peter.hutterer at who-t.net> wrote:
> + const int sz_dbl = sizeof(double);
> /* force alignment with double */
> - union align_u { ValuatorClassRec valc; double d; } *align;
> + union align_u {
> + ValuatorClassRec valc;
> + double d[(sizeof(ValuatorClassRec) + sz_dbl - 1)/sz_dbl];
> + } *align;
This doesn't make sense to me. The requirement for the union is that you
be able to allocate an array of them and store into each element:
union align_u foo[12];
foo[0].d = 0.0;
foo[1].d = 1.0;
This should require double alignment for the entire union, even though
'd' is far smaller than 'valc'.
Of course, on a 32-bit x86 machine, doubles can be stored without
penalty on 4-byte boundaries, so the union is only aligned to 52 bytes.
Can you explain why this alignment isn't acceptable in this context?
--
keith.packard at intel.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110518/2f3cc7e4/attachment.pgp>
More information about the xorg-devel
mailing list