Debian Codegraph @

external/portaudio/pa_endianness.h

raw symbols SCIP
1 #ifndef PA_ENDIANNESS_H
2 #define PA_ENDIANNESS_H
3 /*
4 * $Id$
5 * Portable Audio I/O Library current platform endianness macros
6 *
7 * Based on the Open Source API proposed by Ross Bencina
8 * Copyright (c) 1999-2002 Phil Burk, Ross Bencina
9 *
10 * Permission is hereby granted, free of charge, to any person obtaining
11 * a copy of this software and associated documentation files
12 * (the "Software"), to deal in the Software without restriction,
13 * including without limitation the rights to use, copy, modify, merge,
14 * publish, distribute, sublicense, and/or sell copies of the Software,
15 * and to permit persons to whom the Software is furnished to do so,
16 * subject to the following conditions:
17 *
18 * The above copyright notice and this permission notice shall be
19 * included in all copies or substantial portions of the Software.
20 *
21 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
22 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
23 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
24 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR
25 * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF
26 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
27 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
28 */
29
30 /*
31 * The text above constitutes the entire PortAudio license; however,
32 * the PortAudio community also makes the following non-binding requests:
33 *
34 * Any person wishing to distribute modifications to the Software is
35 * requested to send the modifications to the original developer so that
36 * they can be incorporated into the canonical version. It is also
37 * requested that these non-binding requests be included along with the
38 * license above.
39 */
40
41 /** @file
42 @ingroup common_src
43
44 @brief Configure endianness symbols for the target processor.
45
46 Arrange for either the PA_LITTLE_ENDIAN or PA_BIG_ENDIAN preprocessor symbols
47 to be defined. The one that is defined reflects the endianness of the target
48 platform and may be used to implement conditional compilation of byte-order
49 dependent code.
50
51 If either PA_LITTLE_ENDIAN or PA_BIG_ENDIAN is defined already, then no attempt
52 is made to override that setting. This may be useful if you have a better way
53 of determining the platform's endianness. The autoconf mechanism uses this for
54 example.
55
56 A PA_VALIDATE_ENDIANNESS macro is provided to compare the compile time
57 and runtime endianness and raise an assertion if they don't match.
58 */
59
60
61 #ifdef __cplusplus
62 extern "C"
63 {
64 #endif /* __cplusplus */
65
66 /* PA_VALIDATE_ENDIANNESS compares the compile time and runtime endianness,
67 and raises an assertion if they don't match. <assert.h> must be included in
68 the context in which this macro is used.
69 */
70 #if defined(NDEBUG)
71 #define PA_VALIDATE_ENDIANNESS
72 #else
73 #if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
74 #define PA_VALIDATE_ENDIANNESS \
75 { \
76 const long nativeOne = 1; \
77 assert( "PortAudio: compile time and runtime endianness don't match" && (((char *)&nativeOne)[0]) == 1 ); \
78 }
79 #elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
80 #define PA_VALIDATE_ENDIANNESS \
81 { \
82 const long nativeOne = 1; \
83 assert( "PortAudio: compile time and runtime endianness don't match" && (((char *)&nativeOne)[0]) == 0 ); \
84 }
85 #endif
86 #endif
87
88
89 #ifdef __cplusplus
90 }
91 #endif /* __cplusplus */
92 #endif /* PA_ENDIANNESS_H */