mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-06 13:29:56 -05:00
make use of byte swap builtins of gcc if they are available
git-svn-id: file:///home/lennart/svn/public/pulseaudio/branches/lennart@1880 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
parent
f26de8077d
commit
9db42672d4
2 changed files with 43 additions and 31 deletions
|
|
@ -221,6 +221,7 @@ AC_CHECK_HEADERS([windows.h winsock2.h ws2tcpip.h])
|
|||
|
||||
# Other
|
||||
AC_CHECK_HEADERS([sys/ioctl.h])
|
||||
AC_CHECK_HEADERS([byteswap.h])
|
||||
|
||||
#### Typdefs, structures, etc. ####
|
||||
|
||||
|
|
|
|||
|
|
@ -31,10 +31,21 @@
|
|||
#error "Please include config.h before including this file!"
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BYTESWAP_H
|
||||
#include <byteswap.h>
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_BYTESWAP_H
|
||||
#define INT16_SWAP(x) ((int16_t) bswap_16((uint16_t) x))
|
||||
#define UINT16_SWAP(x) ((uint16_t) bswap_16((uint16_t) x))
|
||||
#define INT32_SWAP(x) ((int32_t) bswap_32((uint32_t) x))
|
||||
#define UINT32_SWAP(x) ((uint32_t) bswap_32((uint32_t) x))
|
||||
#else
|
||||
#define INT16_SWAP(x) ( (int16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
|
||||
#define UINT16_SWAP(x) ( (uint16_t) ( ((uint16_t) x >> 8) | ((uint16_t) x << 8) ) )
|
||||
#define INT32_SWAP(x) ( (int32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
|
||||
#define UINT32_SWAP(x) ( (uint32_t) ( ((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 8) | ((((uint32_t) x) >> 8) & 0xFF00) ) )
|
||||
#endif
|
||||
|
||||
#define MAYBE_INT32_SWAP(c,x) ((c) ? INT32_SWAP(x) : x)
|
||||
#define MAYBE_UINT32_SWAP(c,x) ((c) ? UINT32_SWAP(x) : x)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue