26 #ifndef TAGLIB_TUTILS_H 27 #define TAGLIB_TUTILS_H 31 #ifndef DO_NOT_DOCUMENT // tell Doxygen not to document this header 37 #if defined(HAVE_MSC_BYTESWAP) 39 #elif defined(HAVE_GLIBC_BYTESWAP) 40 # include <byteswap.h> 41 #elif defined(HAVE_MAC_BYTESWAP) 42 # include <libkern/OSByteOrder.h> 43 #elif defined(HAVE_OPENBSD_BYTESWAP) 44 # include <sys/endian.h> 53 #if defined(HAVE_GCC_BYTESWAP_16) 55 return __builtin_bswap16(x);
57 #elif defined(HAVE_MSC_BYTESWAP) 59 return _byteswap_ushort(x);
61 #elif defined(HAVE_GLIBC_BYTESWAP) 65 #elif defined(HAVE_MAC_BYTESWAP) 67 return OSSwapInt16(x);
69 #elif defined(HAVE_OPENBSD_BYTESWAP) 75 return ((x >> 8) & 0xff) | ((x & 0xff) << 8);
82 #if defined(HAVE_GCC_BYTESWAP_32) 84 return __builtin_bswap32(x);
86 #elif defined(HAVE_MSC_BYTESWAP) 88 return _byteswap_ulong(x);
90 #elif defined(HAVE_GLIBC_BYTESWAP) 94 #elif defined(HAVE_MAC_BYTESWAP) 96 return OSSwapInt32(x);
98 #elif defined(HAVE_OPENBSD_BYTESWAP) 104 return ((x & 0xff000000u) >> 24)
105 | ((x & 0x00ff0000u) >> 8)
106 | ((x & 0x0000ff00u) << 8)
107 | ((x & 0x000000ffu) << 24);
114 #if defined(HAVE_GCC_BYTESWAP_64) 116 return __builtin_bswap64(x);
118 #elif defined(HAVE_MSC_BYTESWAP) 120 return _byteswap_uint64(x);
122 #elif defined(HAVE_GLIBC_BYTESWAP) 124 return __bswap_64(x);
126 #elif defined(HAVE_MAC_BYTESWAP) 128 return OSSwapInt64(x);
130 #elif defined(HAVE_OPENBSD_BYTESWAP) 136 return ((x & 0xff00000000000000ull) >> 56)
137 | ((x & 0x00ff000000000000ull) >> 40)
138 | ((x & 0x0000ff0000000000ull) >> 24)
139 | ((x & 0x000000ff00000000ull) >> 8)
140 | ((x & 0x00000000ff000000ull) << 8)
141 | ((x & 0x0000000000ff0000ull) << 24)
142 | ((x & 0x000000000000ff00ull) << 40)
143 | ((x & 0x00000000000000ffull) << 56);
154 #ifdef SYSTEM_BYTEORDER 156 # if SYSTEM_BYTEORDER == 1 158 const ByteOrder SystemByteOrder = LittleEndian;
162 const ByteOrder SystemByteOrder = BigEndian;
168 inline ByteOrder systemByteOrder()
182 const ByteOrder SystemByteOrder = systemByteOrder();
unsigned int uint
Definition: taglib.h:66
unsigned short ushort
Definition: taglib.h:65
unsigned long long ulonglong
Definition: taglib.h:67
A namespace for all TagLib related classes and functions.
Definition: apefile.h:41