OSDN Git Service

speaker-test: move existing endian macros up in the file
authorDan McGee <dpmcgee@gmail.com>
Sun, 10 May 2009 00:47:39 +0000 (02:47 +0200)
committerJaroslav Kysela <perex@perex.cz>
Mon, 11 May 2009 07:08:15 +0000 (09:08 +0200)
This is necessary for a later patch removing the various endianness checks
sprinkled throughout the code.

Signed-off-by: Dan McGee <dpmcgee@gmail.com>
speaker-test/speaker-test.c

index d983a4f..c1d53b6 100644 (file)
@@ -68,6 +68,16 @@ enum {
 
 #define MAX_CHANNELS   16
 
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+#define COMPOSE_ID(a,b,c,d)    ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
+#define LE_SHORT(v)            (v)
+#define LE_INT(v)              (v)
+#else
+#define COMPOSE_ID(a,b,c,d)    ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
+#define LE_SHORT(v)            bswap_16(v)
+#define LE_INT(v)              bswap_32(v)
+#endif
+
 static char              *device      = "default";       /* playback device */
 static snd_pcm_format_t   format      = SND_PCM_FORMAT_S16; /* sample format */
 static unsigned int       rate        = 48000;             /* stream rate */
@@ -520,16 +530,6 @@ struct wave_header {
   } chunk;
 };
 
-#if __BYTE_ORDER == __LITTLE_ENDIAN
-#define COMPOSE_ID(a,b,c,d)    ((a) | ((b)<<8) | ((c)<<16) | ((d)<<24))
-#define LE_SHORT(v)            (v)
-#define LE_INT(v)              (v)
-#else
-#define COMPOSE_ID(a,b,c,d)    ((d) | ((c)<<8) | ((b)<<16) | ((a)<<24))
-#define LE_SHORT(v)            bswap_16(v)
-#define LE_INT(v)              bswap_32(v)
-#endif
-
 #define WAV_RIFF               COMPOSE_ID('R','I','F','F')
 #define WAV_WAVE               COMPOSE_ID('W','A','V','E')
 #define WAV_FMT                        COMPOSE_ID('f','m','t',' ')