]>
code.delx.au - pulseaudio/blob - polyp/endianmacros.h
cd7b7d83364cdf3c39538cd98c9579f472cb7580
1 #ifndef fooendianmacroshfoo
2 #define fooendianmacroshfoo
7 This file is part of polypaudio.
9 polypaudio is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published
11 by the Free Software Foundation; either version 2 of the License,
12 or (at your option) any later version.
14 polypaudio is distributed in the hope that it will be useful, but
15 WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with polypaudio; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
31 #define INT16_SWAP(x) ((int16_t)(((int16_t) x >> 8) | ((int16_t) x << 8)))
32 #define UINT16_SWAP(x) ((uint16_t)(((uint16_t) x >> 8) | ((uint16_t) x << 8)))
33 #define INT32_SWAP(x) ((int32_t)(((int32_t) x >> 24) | ((int32_t) x << 24) | (((int32_t) x & 0xFF00) << 16) | (((int32_t) x) >> 16) & 0xFF00))
34 #define UINT32_SWAP(x) ((uint32_t)(((uint32_t) x >> 24) | ((uint32_t) x << 24) | (((uint32_t) x & 0xFF00) << 16) | (((uint32_t) x) >> 16) & 0xFF00))
36 #ifdef WORDS_BIGENDIAN
37 #define INT16_FROM_LE(x) INT16_SWAP(x)
38 #define INT16_FROM_BE(x) ((int16_t)(x))
39 #define INT16_TO_LE(x) INT16_SWAP(x)
40 #define INT16_TO_BE(x) ((int16_t)(x))
42 #define UINT16_FROM_LE(x) UINT16_SWAP(x)
43 #define UINT16_FROM_BE(x) ((uint16_t)(x))
44 #define INT32_FROM_LE(x) INT32_SWAP(x)
45 #define INT32_FROM_BE(x) ((int32_t)(x))
46 #define UINT32_FROM_LE(x) UINT32_SWAP(x)
47 #define UINT32_FROM_BE(x) ((uint32_t)(x))
49 #define INT16_FROM_LE(x) ((int16_t)(x))
50 #define INT16_FROM_BE(x) INT16_SWAP(x)
51 #define INT16_TO_LE(x) ((int16_t)(x))
52 #define INT16_TO_BE(x) INT16_SWAP(x)
54 #define UINT16_FROM_LE(x) ((uint16_t)(x))
55 #define UINT16_FROM_BE(x) UINT16_SWAP(x)
56 #define INT32_FROM_LE(x) ((int32_t)(x))
57 #define INT32_FROM_BE(x) INT32_SWAP(x)
58 #define UINT32_FROM_LE(x) ((uint32_t)(x))
59 #define UINT32_FROM_BE(x) UINT32_SWAP(x)