Corrected endian test

This commit is contained in:
Jaroslav Kysela 2001-08-22 11:00:07 +00:00
parent f7b6aa50e6
commit abe718c7cf

View file

@ -1,7 +1,7 @@
#ifndef FORMATS_H
#define FORMATS_H 1
#include <sys/types.h>
#include <endian.h>
#include <byteswap.h>
/* Definitions for .VOC files */
@ -44,18 +44,20 @@ typedef struct voc_ext_block {
/* Definitions for Microsoft WAVE format */
#ifdef SND_LITTLE_ENDIAN
#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)
#define BE_SHORT(v) bswap_16(v)
#define BE_INT(v) bswap_32(v)
#else
#elif __BYTE_ORDER == __BIG_ENDIAN
#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)
#define BE_SHORT(v) (v)
#define BE_INT(v) (v)
#else
#error "Wrong endian"
#endif
#define WAV_RIFF COMPOSE_ID('R','I','F','F')