| 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 | #define opus_int int /* used for counters etc; at least 16 bits */ |
| 37 | #define opus_int64 long long |
| 38 | #define opus_int8 signed char |
| 39 | |
| 40 | #define opus_uint unsigned int /* used for counters etc; at least 16 bits */ |
| 41 | #define opus_uint64 unsigned long long |
| 42 | #define opus_uint8 unsigned char |
| 43 | |
| 44 | /* Use the real stdint.h if it's there (taken from Paul Hsieh's pstdint.h) */ |
| 45 | #if (defined(__STDC__) && __STDC__ && defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L) || (defined(__GNUC__) && (defined(_STDINT_H) || defined(_STDINT_H_)) || defined (HAVE_STDINT_H)) |
| 46 | #include <stdint.h> |
| 47 | # undef opus_int64 |
| 48 | # undef opus_int8 |
| 49 | # undef opus_uint64 |
| 50 | # undef opus_uint8 |
| 51 | typedef int8_t opus_int8; |
| 52 | typedef uint8_t opus_uint8; |
| 53 | typedef int16_t opus_int16; |
| 54 | typedef uint16_t opus_uint16; |
| 55 | typedef int32_t opus_int32; |
| 56 | typedef uint32_t opus_uint32; |
| 57 | typedef int64_t opus_int64; |
| 58 | typedef uint64_t opus_uint64; |
| 59 | #elif defined(_WIN32) |
| 60 | |
| 61 | # if defined(__CYGWIN__) |
| 62 | # include <_G_config.h> |
| 63 | typedef _G_int32_t opus_int32; |
| 64 | typedef _G_uint32_t opus_uint32; |
| 65 | typedef _G_int16 opus_int16; |
| 66 | typedef _G_uint16 opus_uint16; |
| 67 | # elif defined(__MINGW32__) |
| 68 | typedef short opus_int16; |
| 69 | typedef unsigned short opus_uint16; |
| 70 | typedef int opus_int32; |
| 71 | typedef unsigned int opus_uint32; |
| 72 | # elif defined(__MWERKS__) |
| 73 | typedef int opus_int32; |
| 74 | typedef unsigned int opus_uint32; |
| 75 | typedef short opus_int16; |
| 76 | typedef unsigned short opus_uint16; |
| 77 | # else |
| 78 | /* MSVC/Borland */ |
| 79 | typedef __int32 opus_int32; |
| 80 | typedef unsigned __int32 opus_uint32; |
| 81 | typedef __int16 opus_int16; |
| 82 | typedef unsigned __int16 opus_uint16; |
| 83 | # endif |
| 84 | |
| 85 | #elif defined(__MACOS__) |
| 86 | |
| 87 | # include <sys/types.h> |
| 88 | typedef SInt16 opus_int16; |
| 89 | typedef UInt16 opus_uint16; |
| 90 | typedef SInt32 opus_int32; |
| 91 | typedef UInt32 opus_uint32; |
| 92 | |
| 93 | #elif (defined(__APPLE__) && defined(__MACH__)) /* MacOS X Framework build */ |
| 94 | |
| 95 | # include <sys/types.h> |
| 96 | typedef int16_t opus_int16; |
| 97 | typedef u_int16_t opus_uint16; |
| 98 | typedef int32_t opus_int32; |
| 99 | typedef u_int32_t opus_uint32; |
| 100 | |
| 101 | #elif defined(__BEOS__) |
| 102 | |
| 103 | /* Be */ |
| 104 | # include <inttypes.h> |
| 105 | typedef int16 opus_int16; |
| 106 | typedef u_int16 opus_uint16; |
| 107 | typedef int32_t opus_int32; |
| 108 | typedef u_int32_t opus_uint32; |
| 109 | |
| 110 | #elif defined (__EMX__) |
| 111 | |
| 112 | /* OS/2 GCC */ |
| 113 | typedef short opus_int16; |
| 114 | typedef unsigned short opus_uint16; |
| 115 | typedef int opus_int32; |
| 116 | typedef unsigned int opus_uint32; |
| 117 | |
| 118 | #elif defined (DJGPP) |
| 119 | |
| 120 | /* DJGPP */ |
| 121 | typedef short opus_int16; |
| 122 | typedef unsigned short opus_uint16; |
| 123 | typedef int opus_int32; |
| 124 | typedef unsigned int opus_uint32; |
| 125 | |
| 126 | #elif defined(R5900) |
| 127 | |
| 128 | /* PS2 EE */ |
| 129 | typedef int opus_int32; |
| 130 | typedef unsigned opus_uint32; |
| 131 | typedef short opus_int16; |
| 132 | typedef unsigned short opus_uint16; |
| 133 | |
| 134 | #elif defined(__SYMBIAN32__) |
| 135 | |
| 136 | /* Symbian GCC */ |
| 137 | typedef signed short opus_int16; |
| 138 | typedef unsigned short opus_uint16; |
| 139 | typedef signed int opus_int32; |
| 140 | typedef unsigned int opus_uint32; |
| 141 | |
| 142 | #elif defined(CONFIG_TI_C54X) || defined (CONFIG_TI_C55X) |
| 143 | |
| 144 | typedef short opus_int16; |
| 145 | typedef unsigned short opus_uint16; |
| 146 | typedef long opus_int32; |
| 147 | typedef unsigned long opus_uint32; |
| 148 | |
| 149 | #elif defined(CONFIG_TI_C6X) |
| 150 | |
| 151 | typedef short opus_int16; |
| 152 | typedef unsigned short opus_uint16; |
| 153 | typedef int opus_int32; |
| 154 | typedef unsigned int opus_uint32; |
| 155 | |
| 156 | #else |
| 157 | |
| 158 | /* Give up, take a reasonable guess */ |
| 159 | typedef short opus_int16; |
| 160 | typedef unsigned short opus_uint16; |
| 161 | typedef int opus_int32; |
| 162 | typedef unsigned int opus_uint32; |
| 163 | |
| 164 | #endif |
| 165 | |
| 166 | #endif /* OPUS_TYPES_H */ |
| 167 | |