[patch 5/6] IP support for PPP
Kristen Carlson Accardi
kristen at linux.intel.com
Wed Mar 17 17:12:00 PDT 2010
On Tue, 16 Mar 2010 23:38:33 -0700
Marcel Holtmann <marcel at holtmann.org> wrote:
> > +static guint32 bytes_to_32(guint8 *bytes)
> > +{
> > + union addr {
> > + guint8 bytes[4];
> > + guint32 word;
> > + } a;
> > +
> > + memcpy(a.bytes, bytes, 4);
> > + return(ntohl(a.word));
> > +}
>
> This works, but is pretty ugly.
>
> Doesn't GLib has functions to ensure retrieve unaligned data? BlueZ has
> the GCC magic that is required to do this right.
>
I have looked everywhere for something nice from glib, but I'm not
seeing it. As far as I can tell, most people just do the bit shifting
manually -- but that's what I had originally and you didn't like it.
So I'm only seeing 2 options here, this way or the original way. If
you know of the glib function to use, please let me know what it is.
More information about the ofono
mailing list