[x264-devel] unaligned accesses in IA64

Håkan Hjort hakan.hjort at gmail.com
Fri Feb 29 02:12:44 CET 2008


2008/2/29 Loren Merritt <lorenm at u.washington.edu>:
> On Thu, 28 Feb 2008, Håkan Hjort wrote:
>  > 2008/2/28 Nestor <ncfernan at gmail.com>:
>  >
>
> > Mauricio please try the attached patch.  It makes the accesses with
>  > the uint64_t* casts aligned to 8 rather than just 4.
>
>  The compiler is free to put padding wherever it wants in a struct, so if
>  your patched worked you just got lucky.
>  The correct way is with DECLARE_ALIGNED.
>
Yes but in practice they do not.  Attached is an updated patch
using DECLARE_ALIGNED.  It is a better solution as it is more
robust against future changes to these structs.

However copying things like this is really not OK.

   *(uint64_t*)mvc[0] = *(uint64_t*)a->l0.mvc[i_ref][0];

Dereferencing these casted pointers breaks the aliasing rules I believe.
The data is accessed both as int (normally), and here, as uint64_t.

Regards,
Håkan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mv_align2.patch
Type: text/x-patch
Size: 1434 bytes
Desc: not available
Url : http://mailman.videolan.org/pipermail/x264-devel/attachments/20080229/d80b9b79/attachment.bin 


More information about the x264-devel mailing list