MythTV  master
bswap.h
Go to the documentation of this file.
1 #ifndef MYTHTV_BSWAP_H
2 #define MYTHTV_BSWAP_H
3 
4 #include <cstdint> /* uint32_t */
5 
6 #define bswap_dbl(x) bswap_64(x)
7 
8 #if HAVE_BYTESWAP_H
9 # include <byteswap.h> /* bswap_16|32|64 */
10 #elif HAVE_SYS_ENDIAN_H
11 # include <sys/endian.h>
12 # if !defined(bswap_16) && defined(bswap16)
13 # define bswap_16(x) bswap16(x)
14 # endif
15 # if !defined(bswap_32) && defined(bswap32)
16 # define bswap_32(x) bswap32(x)
17 # endif
18 # if !defined(bswap_64) && defined(bswap64)
19 # define bswap_64(x) bswap64(x)
20 # endif
21 #elif CONFIG_DARWIN
22 # include <libkern/OSByteOrder.h>
23 # define bswap_16(x) OSSwapInt16(x)
24 # define bswap_32(x) OSSwapInt32(x)
25 # define bswap_64(x) OSSwapInt64(x)
26 #elif HAVE_BIGENDIAN
27 # error Byte swapping functions not defined for this platform
28 #endif
29 
30 #endif /* ndef MYTHTV_BSWAP_H */