summaryrefslogtreecommitdiffstats
path: root/mdk-stage1/dietlibc/lib/htonl.c
blob: 490de42c43efc8f9263ffd4ed1339c2986c69cfd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#include <endian.h>

unsigned long int htonl(unsigned long int hostlong) {
#if __BYTE_ORDER==__LITTLE_ENDIAN
  return (hostlong>>24) | ((hostlong&0xff0000)>>8) |
	  ((hostlong&0xff00)<<8) | (hostlong<<24);
#else
  return hostlong;
#endif
}

unsigned long int ntohl(unsigned long int hostlong) __attribute__((weak,alias("htonl")));