[Ffmpeg-devel] [PATCH] Machine endian bytestream functions

Trent Piepho xyzzy
Wed Apr 25 19:37:39 CEST 2007

On Tue, 24 Apr 2007, Ramiro Ribeiro Polla wrote:
> M?ns Rullg?rd wrote:
> >>> I'm thinking the unaligned16/32/64 macros from bitstream.h should be
> >>> renamed and moved here instead.
> >>>
> >>>
> >> I'll take a look.
> >>
> >
> > This lets the compiler choose whatever access method is appropriate,
> > and saves us the trouble of maintaining a fragile list
> Is there a way for us to get that information off the compiler? (assume
> only gcc atm)
> I thought maybe compile a simple read with __attribute__((packed)) and
> another without the attribute. Then compare object files and assume that
> if they're equal, unaligned access are ok.
> Is that too ugly/random/unreliable?

It won't work.  Pretty much all architectures align fields in structures to
some kind of boundary.  When packed, the structures will be different, even
on those architectures where unaligned accesses are possible.

More information about the ffmpeg-devel mailing list