39 |
*/ |
*/ |
40 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |
41 |
|
|
42 |
#include "lwip/debug.h" |
#include "lwip/opt.h" |
43 |
|
|
44 |
#include "lwip/arch.h" |
#include "lwip/arch.h" |
45 |
|
|
168 |
return ~(acc & 0xffffUL); |
return ~(acc & 0xffffUL); |
169 |
} |
} |
170 |
|
|
171 |
|
#if BYTE_ORDER == LITTLE_ENDIAN |
172 |
|
/*-----------------------------------------------------------------------------------*/ |
173 |
|
u16_t |
174 |
|
htons(u16_t n) |
175 |
|
{ |
176 |
|
return ((n & 0xff) << 8) | ((n & 0xff00) >> 8); |
177 |
|
} |
178 |
|
/*-----------------------------------------------------------------------------------*/ |
179 |
|
u16_t |
180 |
|
ntohs(u16_t n) |
181 |
|
{ |
182 |
|
return htons(n); |
183 |
|
} |
184 |
|
/*-----------------------------------------------------------------------------------*/ |
185 |
|
u32_t |
186 |
|
htonl(u32_t n) |
187 |
|
{ |
188 |
|
return ((n & 0xff) << 24) | |
189 |
|
((n & 0xff00) << 8) | |
190 |
|
((n & 0xff0000) >> 8) | |
191 |
|
((n & 0xff000000) >> 24); |
192 |
|
} |
193 |
|
/*-----------------------------------------------------------------------------------*/ |
194 |
|
u32_t |
195 |
|
ntohl(u32_t n) |
196 |
|
{ |
197 |
|
return htonl(n); |
198 |
|
} |
199 |
/*-----------------------------------------------------------------------------------*/ |
/*-----------------------------------------------------------------------------------*/ |
200 |
|
#endif /* BYTE_ORDER == LITTLE_ENDIAN */ |