Added LWIP_PLATFORM_BYTESWAP optimalisation flag and macro glue.

This commit is contained in:
christiaans
2006-03-29 10:15:43 +00:00
parent d9b4ab1658
commit 94abf9d935
3 changed files with 31 additions and 4 deletions

View File

@@ -489,11 +489,23 @@ char *inet_ntoa(struct in_addr addr)
return str;
}
/*
* These are reference implementations of the byte swapping functions.
* Again with the aim of being simple, correct and fully portable.
* Byte swapping is the second thing you would want to optimize. You will
* need to port it to your architecture and in your cc.h:
*
* #define LWIP_PLATFORM_BYTESWAP 1
* #define LWIP_PLATFORM_HTONS(x) <your_htons>
* #define LWIP_PLATFORM_HTONL(x) <your_htonl>
*
* Note ntohs() and ntohl() are merely references to the htonx counterparts.
*/
#ifndef BYTE_ORDER
#error BYTE_ORDER is not defined
#endif
#if BYTE_ORDER == LITTLE_ENDIAN
#if (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN)
u16_t
htons(u16_t n)
@@ -522,4 +534,4 @@ ntohl(u32_t n)
return htonl(n);
}
#endif /* BYTE_ORDER == LITTLE_ENDIAN */
#endif /* (LWIP_PLATFORM_BYTESWAP == 0) && (BYTE_ORDER == LITTLE_ENDIAN) */