Use autoconf logic to determine byte swapping macro presence. This should now also use other macros if present.

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@76523 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
Joshua Colp
2007-07-23 13:46:57 +00:00
parent ed1775bd10
commit 91c3d90e8f
4 changed files with 292 additions and 5 deletions

View File

@@ -110,7 +110,25 @@ static char version_id[16] = "P002F202";
#define htolel(x) (x)
#define htoles(x) (x)
#else
#if defined(SOLARIS) || defined(__Darwin__) || defined(__NetBSD__) || defined(__OpenBSD__)
#ifdef HAVE_BYTESWAP_H
#include <byteswap.h>
#define letohl(x) bswap_32(x)
#define letohs(x) bswap_16(x)
#define htolel(x) bswap_32(x)
#define htoles(x) bswap_16(x)
#elif HAVE_SYS_ENDIAN_SWAP16
#include <sys/endian.h>
#define letohl(x) __swap32(x)
#define letohs(x) __swap16(x)
#define htolel(x) __swap32(x)
#define htoles(x) __swap16(x)
#elif HAVE_SYS_ENDIAN_BSWAP16
#include <sys/endian.h>
#define letohl(x) bswap32(x)
#define letohs(x) bswap16(x)
#define htolel(x) bswap32(x)
#define htoles(x) bswap16(x)
#else
#define __bswap_16(x) \
((((x) & 0xff00) >> 8) | \
(((x) & 0x00ff) << 8))
@@ -119,14 +137,12 @@ static char version_id[16] = "P002F202";
(((x) & 0x00ff0000) >> 8) | \
(((x) & 0x0000ff00) << 8) | \
(((x) & 0x000000ff) << 24))
#else
#include <bits/byteswap.h>
#endif
#define letohl(x) __bswap_32(x)
#define letohs(x) __bswap_16(x)
#define htolel(x) __bswap_32(x)
#define htoles(x) __bswap_16(x)
#endif
#endif
/*! Global jitterbuffer configuration - by default, jb is disabled */
static struct ast_jb_conf default_jbconf =