• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /************************************************************************
2  * Copyright (C) 2002-2009, Xiph.org Foundation
3  * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above
13  * copyright notice, this list of conditions and the following disclaimer
14  * in the documentation and/or other materials provided with the
15  * distribution.
16  *     * Neither the names of the Xiph.org Foundation nor Pinknoise
17  * Productions Ltd nor the names of its contributors may be used to
18  * endorse or promote products derived from this software without
19  * specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32  ************************************************************************
33 
34  function: #ifdef jail to whip a few platforms into the UNIX ideal.
35 
36  ************************************************************************/
37 #ifndef _OS_TYPES_H
38 #define _OS_TYPES_H
39 
40 #ifdef _LOW_ACCURACY_
41 #  define X(n) (((((n)>>22)+1)>>1) - ((((n)>>22)+1)>>9))
42 #  define LOOKUP_T const unsigned char
43 #else
44 #  define X(n) (n)
45 #  define LOOKUP_T const ogg_int32_t
46 #endif
47 
48 /* make it easy on the folks that want to compile the libs with a
49    different malloc than stdlib */
50 #define _ogg_malloc  malloc
51 #define _ogg_calloc  calloc
52 #define _ogg_realloc realloc
53 #define _ogg_free    free
54 
55 #if defined (_WIN32_WCE)
56 
57    typedef unsigned short ogg_uint16_t;
58    typedef short ogg_int16_t;
59    typedef int ogg_int32_t;
60    typedef unsigned int ogg_uint32_t;
61    typedef __int64 ogg_int64_t;
62 
63    #define inline
64 
65 #elif defined(_WIN32)
66 
67 #  ifndef __GNUC__
68    /* MSVC/Borland */
69    typedef __int64 ogg_int64_t;
70    typedef __int32 ogg_int32_t;
71    typedef unsigned __int32 ogg_uint32_t;
72    typedef __int16 ogg_int16_t;
73    typedef unsigned __int16 ogg_uint16_t;
74 #  else
75    /* Cygwin */
76    #include <_G_config.h>
77    typedef _G_int64_t ogg_int64_t;
78    typedef _G_int32_t ogg_int32_t;
79    typedef _G_uint32_t ogg_uint32_t;
80    typedef _G_int16_t ogg_int16_t;
81    typedef _G_uint16_t ogg_uint16_t;
82 #  endif
83 
84 #elif defined(__MACOS__)
85 
86 #  include <sys/types.h>
87    typedef SInt16 ogg_int16_t;
88    typedef UInt16 ogg_uint16_t;
89    typedef SInt32 ogg_int32_t;
90    typedef UInt32 ogg_uint32_t;
91    typedef SInt64 ogg_int64_t;
92 
93 #elif defined(__MACOSX__) /* MacOS X Framework build */
94 
95 #  include <sys/types.h>
96    typedef int16_t ogg_int16_t;
97    typedef u_int16_t ogg_uint16_t;
98    typedef int32_t ogg_int32_t;
99    typedef u_int32_t ogg_uint32_t;
100    typedef int64_t ogg_int64_t;
101 
102 #elif defined(__BEOS__)
103 
104    /* Be */
105 #  include <inttypes.h>
106 
107 #elif defined (__EMX__)
108 
109    /* OS/2 GCC */
110    typedef short ogg_int16_t;
111    typedef unsigned short ogg_uint16_t;
112    typedef int ogg_int32_t;
113    typedef unsigned int ogg_uint32_t;
114    typedef long long ogg_int64_t;
115 
116 #else
117 
118 #  include <sys/types.h>
119 #  include "config_types.h"
120 #  include <endian.h>
121 
122 #endif
123 
124 #endif  /* _OS_TYPES_H */
125