6 #if __BYTE_ORDER == __BIG_ENDIAN
7 # define BITNR(X) ((X)^31)
8 # if !defined(__constant_htonl)
9 # define __constant_htonl(x) (x)
11 # if !defined(__constant_htons)
12 # define __constant_htons(x) (x)
14 #elif __BYTE_ORDER == __LITTLE_ENDIAN
15 # define BITNR(X) ((X)^7)
16 # if !defined(__constant_htonl)
17 # define __constant_htonl(x) \
18 ((unsigned long int)((((unsigned long int)(x) & 0x000000ffU) << 24) | \
19 (((unsigned long int)(x) & 0x0000ff00U) << 8) | \
20 (((unsigned long int)(x) & 0x00ff0000U) >> 8) | \
21 (((unsigned long int)(x) & 0xff000000U) >> 24)))
23 # if !defined(__constant_htons)
24 # define __constant_htons(x) \
25 ((unsigned short int)((((unsigned short int)(x) & 0x00ff) << 8) | \
26 (((unsigned short int)(x) & 0xff00) >> 8)))
29 # error "Don't know if bytes are big- or little-endian!"