#ifndef _MULTIMEDIA_ARCHDEP_H
#define _MULTIMEDIA_ARCHDEP_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_BIG_ENDIAN)
#define DECODE_SHORT(from, to) *((short *)(to)) = *((short *)(from))
#define DECODE_LONG(from, to) *((long *)(to)) = *((long *)(from))
#define DECODE_FLOAT(from, to) *((float *)(to)) = *((float *)(from))
#define DECODE_DOUBLE(from, to) *((double *)(to)) = *((double *)(from))
#elif defined(_LITTLE_ENDIAN)
#define DECODE_SHORT(from, to) \
((char *)(to))[0] = ((char *)(from))[1]; \
((char *)(to))[1] = ((char *)(from))[0];
#define DECODE_LONG(from, to) \
((char *)(to))[0] = ((char *)(from))[3]; \
((char *)(to))[1] = ((char *)(from))[2]; \
((char *)(to))[2] = ((char *)(from))[1]; \
((char *)(to))[3] = ((char *)(from))[0];
#define DECODE_FLOAT(from, to) DECODE_LONG((to), (from))
#define DECODE_DOUBLE(from, to) \
((char *)(to))[0] = ((char *)(from))[7]; \
((char *)(to))[1] = ((char *)(from))[6]; \
((char *)(to))[2] = ((char *)(from))[5]; \
((char *)(to))[3] = ((char *)(from))[4]; \
((char *)(to))[4] = ((char *)(from))[3]; \
((char *)(to))[5] = ((char *)(from))[2]; \
((char *)(to))[6] = ((char *)(from))[1]; \
((char *)(to))[7] = ((char *)(from))[0];
#else
#error Unknown machine endianness
#endif
#define ENCODE_SHORT(from, to) DECODE_SHORT((from), (to))
#define ENCODE_LONG(from, to) DECODE_LONG((from), (to))
#define ENCODE_FLOAT(from, to) DECODE_FLOAT((from), (to))
#define ENCODE_DOUBLE(from, to) DECODE_DOUBLE((from), (to))
#ifdef __cplusplus
}
#endif
#endif