Re: le32_to_cpu() help...

H. Peter Anvin (hpa@transmeta.com)
3 Nov 1999 09:09:51 GMT


Followup to: <19991102114522.E525@mff.cuni.cz>
By author: Jakub Jelinek <jakub@redhat.com>
In newsgroup: linux.dev.kernel
> >
> > Then when do we use le32_to_cpu( ) , and when do we use cpu_to_le32( )?
>
> The names tell it. le32_to_cpu is used for convesions from 32bit little
> endian data into CPUs endianness, cpu_to_le32 is used for convesions from
> CPU endianness to little endian 32bit data.
> Actually, both macros do the same thing, but one should make the differences
> clear to make code more readable so that anyone can quickly find out whether
> some data is kept in native endianness or some particular one.
>

Both macros do the same thing on all *currently supported*
architectures. One never know when a funny thing from Mars shows up;
perhaps a 48-bit architecture, who knows...

-hpa

-- 
<hpa@transmeta.com> at work, <hpa@zytor.com> in private!

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