[pulseaudio-commits] r1880 - in /branches/lennart: configure.ac src/pulsecore/endianmacros.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Fri Sep 21 17:21:08 PDT 2007


Author: lennart
Date: Sat Sep 22 02:21:08 2007
New Revision: 1880

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=1880&root=pulseaudio&view=rev
Log:
make use of byte swap builtins of gcc if they are available

Modified:
    branches/lennart/configure.ac
    branches/lennart/src/pulsecore/endianmacros.h

Modified: branches/lennart/configure.ac
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/configure.ac?rev=1880&root=pulseaudio&r1=1879&r2=1880&view=diff
==============================================================================
--- branches/lennart/configure.ac (original)
+++ branches/lennart/configure.ac Sat Sep 22 02:21:08 2007
@@ -97,13 +97,13 @@
 
     for flag in $DESIRED_FLAGS ; do
         AC_MSG_CHECKING([whether $CC accepts $flag])
-        if test_gcc_flag $flag ; then 
+        if test_gcc_flag $flag ; then
            CFLAGS="$CFLAGS $flag"
            AC_MSG_RESULT([yes])
         else
            AC_MSG_RESULT([no])
         fi
-    done 
+    done
 fi
 
 AC_MSG_CHECKING([whether $CC knows __sync_bool_compare_and_swap()])
@@ -221,6 +221,7 @@
 
 # Other
 AC_CHECK_HEADERS([sys/ioctl.h])
+AC_CHECK_HEADERS([byteswap.h])
 
 #### Typdefs, structures, etc. ####
 
@@ -302,7 +303,7 @@
 
 AC_MSG_CHECKING([for PTHREAD_PRIO_INHERIT])
 AC_LANG_CONFTEST([AC_LANG_SOURCE([[
-#include <pthread.h> 
+#include <pthread.h>
 int main() { int i = PTHREAD_PRIO_INHERIT; }]])])
 $PTHREAD_CC conftest.c $PTHREAD_CFLAGS $CFLAGS $PTHREAD_LIBS -o conftest > /dev/null 2> /dev/null
 ret=$?
@@ -397,8 +398,8 @@
 
 #### Libsamplerate support (optional) ####
 
-AC_ARG_ENABLE([samplerate], 
-    AC_HELP_STRING([--disable-samplerate], [Disable optional libsamplerate support]), 
+AC_ARG_ENABLE([samplerate],
+    AC_HELP_STRING([--disable-samplerate], [Disable optional libsamplerate support]),
         [
             case "${enableval}" in
                 yes) samplerate=yes ;;
@@ -432,8 +433,8 @@
 
 #### OSS support (optional) ####
 
-AC_ARG_ENABLE([oss], 
-    AC_HELP_STRING([--disable-oss], [Disable optional OSS support]), 
+AC_ARG_ENABLE([oss],
+    AC_HELP_STRING([--disable-oss], [Disable optional OSS support]),
         [
             case "${enableval}" in
                 yes) oss=yes ;;
@@ -465,8 +466,8 @@
 
 #### ALSA support (optional) ####
 
-AC_ARG_ENABLE([alsa], 
-    AC_HELP_STRING([--disable-alsa], [Disable optional ALSA support]), 
+AC_ARG_ENABLE([alsa],
+    AC_HELP_STRING([--disable-alsa], [Disable optional ALSA support]),
         [
             case "${enableval}" in
                 yes) alsa=yes ;;
@@ -493,14 +494,14 @@
 fi
 
 AC_SUBST(ASOUNDLIB_CFLAGS)
-AC_SUBST(ASOUNDLIB_LIBS) 
+AC_SUBST(ASOUNDLIB_LIBS)
 AC_SUBST(HAVE_ALSA)
 AM_CONDITIONAL([HAVE_ALSA], [test "x$HAVE_ALSA" = x1])
 
 #### Solaris audio support (optional) ####
 
-AC_ARG_ENABLE([solaris], 
-    AC_HELP_STRING([--disable-solaris], [Disable optional Solaris audio support]), 
+AC_ARG_ENABLE([solaris],
+    AC_HELP_STRING([--disable-solaris], [Disable optional Solaris audio support]),
         [
             case "${enableval}" in
                 yes) solaris=yes ;;
@@ -531,8 +532,8 @@
 
 #### GLib 2 support (optional) ####
 
-AC_ARG_ENABLE([glib2], 
-    AC_HELP_STRING([--disable-glib2], [Disable optional GLib 2 support]), 
+AC_ARG_ENABLE([glib2],
+    AC_HELP_STRING([--disable-glib2], [Disable optional GLib 2 support]),
         [
             case "${enableval}" in
                 yes) glib2=yes ;;
@@ -562,8 +563,8 @@
 
 #### GConf support (optional) ####
 
-AC_ARG_ENABLE([gconf], 
-    AC_HELP_STRING([--disable-gconf], [Disable optional GConf support]), 
+AC_ARG_ENABLE([gconf],
+    AC_HELP_STRING([--disable-gconf], [Disable optional GConf support]),
         [
             case "${enableval}" in
                 yes) gconf=yes ;;
@@ -593,8 +594,8 @@
 
 #### Avahi support (optional) ####
 
-AC_ARG_ENABLE([avahi], 
-    AC_HELP_STRING([--disable-avahi], [Disable optional Avahi support]), 
+AC_ARG_ENABLE([avahi],
+    AC_HELP_STRING([--disable-avahi], [Disable optional Avahi support]),
         [
             case "${enableval}" in
                 yes) avahi=yes ;;
@@ -630,8 +631,8 @@
 
 ### JACK (optional) ####
 
-AC_ARG_ENABLE([jack], 
-    AC_HELP_STRING([--disable-jack], [Disable optional JACK support]), 
+AC_ARG_ENABLE([jack],
+    AC_HELP_STRING([--disable-jack], [Disable optional JACK support]),
         [
             case "${enableval}" in
                 yes) jack=yes ;;
@@ -661,8 +662,8 @@
 
 #### Async DNS support (optional) ####
 
-AC_ARG_ENABLE([asyncns], 
-    AC_HELP_STRING([--disable-asyncns], [Disable optional Async DNS support]), 
+AC_ARG_ENABLE([asyncns],
+    AC_HELP_STRING([--disable-asyncns], [Disable optional Async DNS support]),
         [
             case "${enableval}" in
                 yes) asyncns=yes ;;
@@ -696,8 +697,8 @@
 
 #### TCP wrappers (optional) ####
 
-AC_ARG_ENABLE([tcpwrap], 
-    AC_HELP_STRING([--disable-tcpwrap], [Disable optional TCP wrappers support]), 
+AC_ARG_ENABLE([tcpwrap],
+    AC_HELP_STRING([--disable-tcpwrap], [Disable optional TCP wrappers support]),
         [
             case "${enableval}" in
                 yes) tcpwrap=yes ;;
@@ -720,8 +721,8 @@
 
 #### LIRC support (optional) ####
 
-AC_ARG_ENABLE([lirc], 
-    AC_HELP_STRING([--disable-lirc], [Disable optional LIRC support]), 
+AC_ARG_ENABLE([lirc],
+    AC_HELP_STRING([--disable-lirc], [Disable optional LIRC support]),
         [
             case "${enableval}" in
                 yes) lirc=yes ;;
@@ -746,8 +747,8 @@
 
 #### HAL support (optional) ####
 
-AC_ARG_ENABLE([hal], 
-    AC_HELP_STRING([--disable-hal], [Disable optional HAL support]), 
+AC_ARG_ENABLE([hal],
+    AC_HELP_STRING([--disable-hal], [Disable optional HAL support]),
         [
             case "${enableval}" in
                 yes) hal=yes ;;
@@ -776,8 +777,8 @@
 
 #### D-Bus support (optional) ####
 
-AC_ARG_ENABLE([dbus], 
-    AC_HELP_STRING([--disable-dbus], [Disable optional D-Bus support]), 
+AC_ARG_ENABLE([dbus],
+    AC_HELP_STRING([--disable-dbus], [Disable optional D-Bus support]),
         [
             case "${enableval}" in
                 yes) dbus=yes ;;
@@ -787,7 +788,7 @@
         ],
         [dbus=auto])
 
-if test "x$HAVE_HAL" = x1 ; then 
+if test "x$HAVE_HAL" = x1 ; then
    dbus=yes
 fi
 

Modified: branches/lennart/src/pulsecore/endianmacros.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/branches/lennart/src/pulsecore/endianmacros.h?rev=1880&root=pulseaudio&r1=1879&r2=1880&view=diff
==============================================================================
--- branches/lennart/src/pulsecore/endianmacros.h (original)
+++ branches/lennart/src/pulsecore/endianmacros.h Sat Sep 22 02:21:08 2007
@@ -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)




More information about the pulseaudio-commits mailing list