Add macros to read/write integers from/to memory, like GST_READ/WRITE
@malureau
Submitted by Marc-André Lureau Link to original bug (#693754)
Description
GStreamer has pretty useful macros to read and write integers respecting a given endian, of this kind:
#define _GST_GET(__data, __idx, __size, __shift)
(((guint##__size) (((const guint8 *) (__data))[__idx])) << (__shift))
#define GST_READ_UINT32_LE(data) (_GST_GET (data, 3, 32, 24) |
_GST_GET (data, 2, 32, 16) |
_GST_GET (data, 1, 32, 8) |
_GST_GET (data, 0, 32, 0))
See documentation: http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer/html/gstreamer-GstUtils.html
That would be a nice complement when a GDataInputStream (MemoryInputStream) is just too heavy for the job at hand, and they would have 0 overhead to GLib.