aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_skinny.c
diff options
context:
space:
mode:
authorfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-23 13:46:57 +0000
committerfile <file@f38db490-d61c-443f-a65b-d21fe96a405b>2007-07-23 13:46:57 +0000
commit92866521234732bd0266da0ed0483eee919bb345 (patch)
treef546eff309c8edef6b6ee96ee2a96f6591d663d8 /channels/chan_skinny.c
parentc5fd13bbcdc2e31ca024914388b9fe137d2122ec (diff)
Use autoconf logic to determine byte swapping macro presence. This should now also use other macros if present.
git-svn-id: http://svn.digium.com/svn/asterisk/trunk@76523 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/chan_skinny.c')
-rw-r--r--channels/chan_skinny.c24
1 files changed, 20 insertions, 4 deletions
diff --git a/channels/chan_skinny.c b/channels/chan_skinny.c
index f646362d7..241629200 100644
--- a/channels/chan_skinny.c
+++ b/channels/chan_skinny.c
@@ -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 =