[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[lwip-users] [lwip] Little/Big -endian
From: |
Mikael Lundberg |
Subject: |
[lwip-users] [lwip] Little/Big -endian |
Date: |
Wed, 08 Jan 2003 22:34:44 -0000 |
Hi.
If I want to change to Big endian, what changes will I have to do?
My changes so far is:
In the file cpu.h;
#define BYTE_ORDER BIG_ENDIAN
In the file lib.c, I have change the two following functions...
/*----------------------------------------------------------------*/
u16_t
htons(u16_t n)
{
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8);
}
/*----------------------------------------------------------------*/
u32_t
htonl(u32_t n)
{
return ((n & 0xff) << 24) |
((n & 0xff00) << 8) |
((n & 0xff0000) >> 8) |
((n & 0xff000000) >> 24);
}
to...
/*----------------------------------------------------------------*/
u16_t
htons(u16_t n)
{
return n;
}
/*----------------------------------------------------------------*/
u32_t
htonl(u32_t n)
{
return n ;
}
Its what right (and enough) ?
regards
//Mikael Lundberg
[This message was sent through the lwip discussion list.]
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [lwip-users] [lwip] Little/Big -endian,
Mikael Lundberg <=