[FFmpeg-devel] [PATCH] Make HAVE_FAST_UNALIGNED allow unaligned memory accesses
Tue Jul 15 22:36:47 CEST 2008
On Tue, 2008-07-15 at 20:55 +0100, M?ns Rullg?rd wrote:
> Reimar D?ffinger <Reimar.Doeffinger at stud.uni-karlsruhe.de> writes:
> > can the current __GNUC__ be checked reliably? That
> > __attribute__((packed)) acts as "unaligned marker" for structs with only
> > one element is something that on first sight I would consider a compiler
> > bug, in which case it would be really hard to check for...
> GCC has always behaved like this. However, the documentation for the
> 'packed' attribute makes no mention of this.
The documentation of 'packed' does not directly address its use on a
struct definition, but the documentation of 'aligned' does mention that
use of 'packed'.
A more straightforward implementation of AV_RN32 etc would be (at least
if the documentation of "align" is correct):
typedef uint32_t av_unaligned_32 __attribute__((aligned(1)));
#define AV_RN32(a) (*(const av_unaligned_32 *)a)
More information about the ffmpeg-devel