[PATCH] input: properly align doubles in InitValuatorClassDeviceStruct

Daniel Stone daniel at fooishbar.org
Sat Feb 26 01:27:28 PST 2011


On Fri, Feb 25, 2011 at 09:02:20PM -0800, Keith Packard wrote:
> On Sat, 26 Feb 2011 00:00:39 +0100, Julien Cristau <jcristau at debian.org> wrote:
> > Some architectures (hi, sparc!) are unhappy with unaligned memory
> > accesses.  So make sure the axisVal member of ValuatorClassRec has
> > sizeof(double) alignment to avoid crashes and test failures.
> 
> The 'standard' way to do this is to use a union to ensure correct
> alignment. Seems like simply moving the doubles to after the
> ValuatorClassRec and using a union between a double and the
> ValuatorClassRec would fix this without a lot of ugly pointer computations.

If we're going for more-invasive patches, why not just allocate axisVal
separately from ValuatorClassRec?

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110226/e9da7d56/attachment.pgp>


More information about the xorg-devel mailing list