Re: [RFC-PATCH] lib: add byteorder helpers for the aligned case

From: Harvey Harrison
Date: Fri May 16 2008 - 20:38:26 EST


On Fri, 2008-05-16 at 20:35 -0400, Alan Stern wrote:
> On Fri, 16 May 2008, Harvey Harrison wrote:
>
> > +static inline void put_le16(u16 val, void *ptr)
> > +{
> > + *(__le16 *)ptr = cpu_to_le16(val);
> > +}
>
> Is this able to do the byte rearrangement at compile time if val is a
> compile-time constant? I imagine it would.
>

Yes, the cpu_to_le/be functions to get optimized if they are passed a
compile time constant.


Harvey

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/