[gst-devel] alignment issues

David Schleef ds at schleef.org
Sun Apr 4 12:09:02 CEST 2004


On Sat, Apr 03, 2004 at 08:35:13PM +0200, Ronald Bultje wrote:
> Please do. I sort-of dislike memcpy() though... Can you think of a quick
> macro to do this? E.g.:
> 
> #define GST_READ_UINT32_BE(data) (data[0] << 24 | \
> 				  data[1] << 16 | \
> 				  data[2] <<  8 | \
> 				  data[3]         )
> 
> (etc.)
> 
> Same for uint64, 16, all also LE and maybe even several write macros. Such
> code should go somewhere in GStreamer core, I guess, since those are used
> virtually everywhere.

Please hide this behind an #ifdef.  Sane architectures have no
problem reading and writing unaligned words, most of them with
no speed penalty.



dave...





More information about the gstreamer-devel mailing list