OSDN Git Service

Endianess cleaning
authorAbramo Bagnara <abramo@alsa-project.org>
Tue, 30 May 2000 18:54:44 +0000 (18:54 +0000)
committerAbramo Bagnara <abramo@alsa-project.org>
Tue, 30 May 2000 18:54:44 +0000 (18:54 +0000)
src/pcm/pcm_misc.c
src/pcm/plugin/adpcm.c
src/pcm/plugin/alaw.c
src/pcm/plugin/copy.c
src/pcm/plugin/linear.c
src/pcm/plugin/mulaw.c
src/pcm/plugin/rate.c
src/pcm/plugin/route.c

index 3eeddb5..b578df7 100644 (file)
@@ -30,7 +30,6 @@
 #include <string.h>
 #include <byteswap.h>
 #include <errno.h>
-#include <endian.h>
 #include <byteswap.h>
 #include "pcm_local.h"
 #endif
@@ -249,54 +248,42 @@ u_int64_t snd_pcm_format_silence_64(int format)
        case SND_PCM_SFMT_U16_LE:
        case SND_PCM_SFMT_U24_LE:
        case SND_PCM_SFMT_U32_LE:
-#if defined(LITTLE_ENDIAN)
+#ifdef SND_LITTLE_ENDIAN
                return 0x8000800080008000UL;
-#elif defined(BIG_ENDIAN)
-               return 0x0080008000800080UL;
 #else
-#error "endian"
+               return 0x0080008000800080UL;
 #endif
        case SND_PCM_SFMT_U16_BE:
        case SND_PCM_SFMT_U24_BE:
        case SND_PCM_SFMT_U32_BE:
-#if defined(LITTLE_ENDIAN)
+#ifdef SND_LITTLE_ENDIAN
                return 0x0000008000000080UL;
-#elif defined(BIG_ENDIAN)
-               return 0x8000000080000000UL;
 #else
-#error "endian"
+               return 0x8000000080000000UL;
 #endif
        case SND_PCM_SFMT_FLOAT_LE:             
-#if defined(LITTLE_ENDIAN)
+#ifdef SND_LITTLE_ENDIAN
                return (float)0.0;
-#elif defined(BIG_ENDIAN)
-               return bswap_32((u_int32_t)((float)0.0));
 #else
-#error "endian"
+               return bswap_32((u_int32_t)((float)0.0));
 #endif
        case SND_PCM_SFMT_FLOAT64_LE:
-#if defined(LITTLE_ENDIAN)
+#ifdef SND_LITTLE_ENDIAN
                return (double)0.0;
-#elif defined(BIG_ENDIAN)
-               return bswap_64((u_int64_t)((double)0.0));
 #else
-#error "endian"
+               return bswap_64((u_int64_t)((double)0.0));
 #endif
        case SND_PCM_SFMT_FLOAT_BE:             
-#if defined(LITTLE_ENDIAN)
+#ifdef SND_LITTLE_ENDIAN
                return bswap_32((u_int32_t)((float)0.0));
-#elif defined(BIG_ENDIAN)
-               return (float)0.0;
 #else
-#error "endian"
+               return (float)0.0;
 #endif
        case SND_PCM_SFMT_FLOAT64_BE:
-#if defined(LITTLE_ENDIAN)
+#ifdef SND_LITTLE_ENDIAN
                return bswap_64((u_int64_t)((double)0.0));
-#elif defined(BIG_ENDIAN)
-               return (double)0.0;
 #else
-#error "endian"
+               return (double)0.0;
 #endif
        case SND_PCM_SFMT_IEC958_SUBFRAME_LE:
        case SND_PCM_SFMT_IEC958_SUBFRAME_BE:
index cf2c16d..7cedfa4 100644 (file)
@@ -51,7 +51,6 @@ IMA compatability project proceedings, Vol 2, Issue 2, May 1992.
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <endian.h>
 #include <byteswap.h>
 #include "../pcm_local.h"
 
index 1be3c2b..0335ea3 100644 (file)
@@ -26,7 +26,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <endian.h>
 #include <byteswap.h>
 #include <sys/uio.h>
 #include "../pcm_local.h"
index 450fb3e..f009ee5 100644 (file)
@@ -29,7 +29,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <endian.h>
 #include <byteswap.h>
 #include <sys/uio.h>
 #include "../pcm_local.h"
index 6e232b3..5ad1256 100644 (file)
@@ -30,7 +30,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <endian.h>
 #include <byteswap.h>
 #include <sys/uio.h>
 #include "../pcm_local.h"
@@ -116,14 +115,12 @@ int conv_index(int src_format, int dst_format)
 
        sign = (snd_pcm_format_signed(src_format) !=
                snd_pcm_format_signed(dst_format));
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef SND_LITTLE_ENDIAN
        src_endian = snd_pcm_format_big_endian(src_format);
        dst_endian = snd_pcm_format_big_endian(dst_format);
-#elif __BYTE_ORDER == __BIG_ENDIAN
+#else
        src_endian = snd_pcm_format_little_endian(src_format);
        dst_endian = snd_pcm_format_little_endian(dst_format);
-#else
-#error "Unsupported endian..."
 #endif
 
        if (src_endian < 0)
index af82c29..4fad670 100644 (file)
@@ -31,7 +31,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <endian.h>
 #include <byteswap.h>
 #include <sys/uio.h>
 #include "../pcm_local.h"
index 55d8540..f829b59 100644 (file)
@@ -29,7 +29,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <endian.h>
 #include <byteswap.h>
 #include "../pcm_local.h"
 #endif
index 3f19163..f403259 100644 (file)
@@ -29,7 +29,6 @@
 #include <unistd.h>
 #include <string.h>
 #include <errno.h>
-#include <endian.h>
 #include <byteswap.h>
 #include <math.h>
 #include "../pcm_local.h"
@@ -530,12 +529,10 @@ int getput_index(int format)
        int sign, width, endian;
        sign = !snd_pcm_format_signed(format);
        width = snd_pcm_format_width(format) / 8 - 1;
-#if __BYTE_ORDER == __LITTLE_ENDIAN
+#ifdef SND_LITTLE_ENDIAN
        endian = snd_pcm_format_big_endian(format);
-#elif __BYTE_ORDER == __BIG_ENDIAN
-       endian = snd_pcm_format_little_endian(format);
 #else
-#error "Unsupported endian..."
+       endian = snd_pcm_format_little_endian(format);
 #endif
        if (endian < 0)
                endian = 0;