[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] Re: [lwip] Little/Big -endian
From: |
Jamesz |
Subject: |
[lwip-users] Re: [lwip] Little/Big -endian |
Date: |
Wed, 08 Jan 2003 22:43:21 -0000 |
Hi,
Try below:
#if defined(BIG_ENDIAN)
#define htons(A) (A)
#define htonl(A) (A)
#define ntohs(A) (A)
#define ntohl(A) (A)
#elif defined(LITTLE_ENDIAN)
#define htons(A) ((((A) & 0xFF00) >> 8) | \
(((A) & 0x00FF) << 8))
#define htonl(A) ((((A) & 0xFF000000) >> 24) | \
(((A) & 0x00FF0000) >> 8) | \
(((A) & 0x0000FF00) << 8) | \
(((A) & 0x000000FF) << 24))
or you can refer to linux net source code or ucip on sourceforg.net.
Good Luck
Jamesz
address@hidden
[This message was sent through the lwip discussion list.]