12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- #include "api.h"
- #include <host_endian.h>
- uint32_t __htonl (uint32_t x)
- {
- #if BYTE_ORDER == BIG_ENDIAN
- return x;
- #elif BYTE_ORDER == LITTLE_ENDIAN
- return __bswap_32 (x);
- #else
- # error "What kind of system is this?"
- #endif
- }
- uint32_t __ntohl (uint32_t x)
- {
- return __htonl (x);
- }
- uint16_t __htons (uint16_t x)
- {
- #if BYTE_ORDER == BIG_ENDIAN
- return x;
- #elif BYTE_ORDER == LITTLE_ENDIAN
- return __bswap_16 (x);
- #else
- # error "What kind of system is this?"
- #endif
- }
- uint16_t __ntohs (uint16_t x)
- {
- return __htons (x);
- }
|