1 /* (C) COPYRIGHT 1994-2002 Xiph.Org Foundation */
2 /* Modified by Jean-Marc Valin */
3 /*
4    Redistribution and use in source and binary forms, with or without
5    modification, are permitted provided that the following conditions
6    are met:
7 
8    - Redistributions of source code must retain the above copyright
9    notice, this list of conditions and the following disclaimer.
10 
11    - Redistributions in binary form must reproduce the above copyright
12    notice, this list of conditions and the following disclaimer in the
13    documentation and/or other materials provided with the distribution.
14 
15    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16    ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17    LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
18    A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
19    OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20    EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21    PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
22    PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
23    LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
24    NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
25    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */
27 /* opus_types.h based on ogg_types.h from libogg */
28 
29 /**
30    @file opus_types.h
31    @brief Opus reference implementation types
32 */
33 #ifndef OPUS_TYPES_H
34 #define OPUS_TYPES_H
35 
36 /* Use the real stdint.h if it's there (taken from Paul Hsieh's pstdint.h) */
37 #if (defined(__STDC__) && __STDC__ && __STDC_VERSION__ >= 199901L) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) || defined (HAVE_STDINT_H))
38 #include <stdint.h>
39 
40    typedef int16_t opus_int16;
41    typedef uint16_t opus_uint16;
42    typedef int32_t opus_int32;
43    typedef uint32_t opus_uint32;
44 #elif defined(_WIN32)
45 
46 #  if defined(__CYGWIN__)
47 #    include <_G_config.h>
48      typedef _G_int32_t opus_int32;
49      typedef _G_uint32_t opus_uint32;
50      typedef _G_int16 opus_int16;
51      typedef _G_uint16 opus_uint16;
52 #  elif defined(__MINGW32__)
53      typedef short opus_int16;
54      typedef unsigned short opus_uint16;
55      typedef int opus_int32;
56      typedef unsigned int opus_uint32;
57 #  elif defined(__MWERKS__)
58      typedef int opus_int32;
59      typedef unsigned int opus_uint32;
60      typedef short opus_int16;
61      typedef unsigned short opus_uint16;
62 #  else
63      /* MSVC/Borland */
64      typedef __int32 opus_int32;
65      typedef unsigned __int32 opus_uint32;
66      typedef __int16 opus_int16;
67      typedef unsigned __int16 opus_uint16;
68 #  endif
69 
70 #elif defined(__MACOS__)
71 
72 #  include <sys/types.h>
73    typedef SInt16 opus_int16;
74    typedef UInt16 opus_uint16;
75    typedef SInt32 opus_int32;
76    typedef UInt32 opus_uint32;
77 
78 #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */
79 
80 #  include <sys/types.h>
81    typedef int16_t opus_int16;
82    typedef u_int16_t opus_uint16;
83    typedef int32_t opus_int32;
84    typedef u_int32_t opus_uint32;
85 
86 #elif defined(__BEOS__)
87 
88    /* Be */
89 #  include <inttypes.h>
90    typedef int16 opus_int16;
91    typedef u_int16 opus_uint16;
92    typedef int32_t opus_int32;
93    typedef u_int32_t opus_uint32;
94 
95 #elif defined (__EMX__)
96 
97    /* OS/2 GCC */
98    typedef short opus_int16;
99    typedef unsigned short opus_uint16;
100    typedef int opus_int32;
101    typedef unsigned int opus_uint32;
102 
103 #elif defined (DJGPP)
104 
105    /* DJGPP */
106    typedef short opus_int16;
107    typedef unsigned short opus_uint16;
108    typedef int opus_int32;
109    typedef unsigned int opus_uint32;
110 
111 #elif defined(R5900)
112 
113    /* PS2 EE */
114    typedef int opus_int32;
115    typedef unsigned opus_uint32;
116    typedef short opus_int16;
117    typedef unsigned short opus_uint16;
118 
119 #elif defined(__SYMBIAN32__)
120 
121    /* Symbian GCC */
122    typedef signed short opus_int16;
123    typedef unsigned short opus_uint16;
124    typedef signed int opus_int32;
125    typedef unsigned int opus_uint32;
126 
127 #elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X)
128 
129    typedef short opus_int16;
130    typedef unsigned short opus_uint16;
131    typedef long opus_int32;
132    typedef unsigned long opus_uint32;
133 
134 #elif defined(CONFIG_TI_C6X)
135 
136    typedef short opus_int16;
137    typedef unsigned short opus_uint16;
138    typedef int opus_int32;
139    typedef unsigned int opus_uint32;
140 
141 #else
142 
143    /* Give up, take a reasonable guess */
144    typedef short opus_int16;
145    typedef unsigned short opus_uint16;
146    typedef int opus_int32;
147    typedef unsigned int opus_uint32;
148 
149 #endif
150 
151 #define opus_int         int                     /* used for counters etc; at least 16 bits */
152 #define opus_int64       long long
153 #define opus_int8        signed char
154 
155 #define opus_uint        unsigned int            /* used for counters etc; at least 16 bits */
156 #define opus_uint64      unsigned long long
157 #define opus_uint8       unsigned char
158 
159 #endif  /* OPUS_TYPES_H */
160