1#ifndef _OS_H
2#define _OS_H
3/************************************************************************
4 * Copyright (C) 2002-2009, Xiph.org Foundation
5 * Copyright (C) 2010, Robin Watts for Pinknoise Productions Ltd
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 *
12 *     * Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 *     * Redistributions in binary form must reproduce the above
15 * copyright notice, this list of conditions and the following disclaimer
16 * in the documentation and/or other materials provided with the
17 * distribution.
18 *     * Neither the names of the Xiph.org Foundation nor Pinknoise
19 * Productions Ltd nor the names of its contributors may be used to
20 * endorse or promote products derived from this software without
21 * specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 ************************************************************************
35
36 function: #ifdef jail to whip a few platforms into the UNIX ideal.
37
38 ************************************************************************/
39
40#include <math.h>
41#include "os_types.h"
42
43#ifndef _V_IFDEFJAIL_H_
44#  define _V_IFDEFJAIL_H_
45
46#  ifdef __GNUC__
47#    define STIN static __inline__
48#  elif _WIN32
49#    define STIN static __inline
50#  endif
51#else
52#  define STIN static
53#endif
54
55#ifndef M_PI
56#  define M_PI (3.1415926536f)
57#endif
58
59#ifdef _WIN32
60#  include <malloc.h>
61#  define rint(x)   (floor((x)+0.5f))
62#  define NO_FLOAT_MATH_LIB
63#  define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
64#endif
65
66#ifdef HAVE_ALLOCA_H
67#  include <alloca.h>
68#endif
69
70#ifdef USE_MEMORY_H
71#  include <memory.h>
72#endif
73
74#ifndef min
75#  define min(x,y)  ((x)>(y)?(y):(x))
76#endif
77
78#ifndef max
79#  define max(x,y)  ((x)<(y)?(y):(x))
80#endif
81
82#endif /* _OS_H */
83