fix missing uintXX_t in nameser.h
[musl] / include / byteswap.h
1 #ifndef _BYTESWAP_H
2 #define _BYTESWAP_H
3
4 #include <stdint.h>
5
6 #if __STDC_VERSION__ >= 199901L
7 inline
8 #endif
9 static uint16_t __bswap_16(uint16_t __x)
10 {
11         return __x<<8 | __x>>8;
12 }
13
14 #if __STDC_VERSION__ >= 199901L
15 inline
16 #endif
17 static uint32_t __bswap_32(uint32_t __x)
18 {
19         return __x>>24 | __x>>8&0xff00 | __x<<8&0xff0000 | __x<<24;
20 }
21
22 #if __STDC_VERSION__ >= 199901L
23 inline
24 #endif
25 static uint64_t __bswap_64(uint64_t __x)
26 {
27         return __bswap_32(__x)+0ULL<<32 | __bswap_32(__x>>32);
28 }
29
30 #define bswap_16(x) __bswap_16(x)
31 #define bswap_32(x) __bswap_32(x)
32 #define bswap_64(x) __bswap_64(x)
33
34 #endif