Thread (1 message) 1 message, 1 author, 1999-12-04
  • (off-list ancestor, not in this archive)
  • Re: endian-swapping · David Edelsohn <hidden> · 1999-12-04

Re: endian-swapping

From: David Edelsohn <hidden>
Date: 1999-12-04 01:56:23

quoted
quoted
quoted
quoted
Hollis R Blanchard writes:
Hollis> On Fri, 3 Dec 1999, David Edelsohn wrote:
quoted
Linux already provides macros like le16_to_cpu(), etc. for this. 
Hollis> For the sake of someone (like me) who doesn't know how to use these, can you
Hollis> give an example?

	See drivers/net/pcnet32.c for one example of its use.  There are
no #ifdef's like NetBSD uses.  le16_to_cpu() is a no-op on LE machines, so
one uses it directly like 

short x = le16_to_cpu(dev_flag);

Hollis> Also, the macros are in which header? I'm having trouble finding them too...

	The macros seem to be included via <asm/bitops.h> which then
include <linux/byteorder/big_endian.h> (for example).

David

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help