os.h revision 37fe158a8611dd11ec0253ab1552399b780988dc
1#ifndef _OS_H
2#define _OS_H
3/************************************************************************
4 * Copyright (C) 2010, The Android Open Source Project
5 * All rights reserved.
6 *
7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions are
9 * met:
10 *
11 *     * Redistributions of source code must retain the above copyright
12 * notice, this list of conditions and the following disclaimer.
13 *     * Redistributions in binary form must reproduce the above
14 * copyright notice, this list of conditions and the following disclaimer
15 * in the documentation and/or other materials provided with the
16 * distribution.
17 *     * Neither the name of the Android Open Source Project nor the
18 * names of its contributors may be used to endorse or promote products
19 * derived from this software without 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
38#include <math.h>
39#include "os_types.h"
40
41#ifndef _V_IFDEFJAIL_H_
42#  define _V_IFDEFJAIL_H_
43
44#  ifdef __GNUC__
45#    define STIN static __inline__
46#  elif _WIN32
47#    define STIN static __inline
48#  endif
49#else
50#  define STIN static
51#endif
52
53#ifndef M_PI
54#  define M_PI (3.1415926536f)
55#endif
56
57#ifdef _WIN32
58#  include <malloc.h>
59#  define rint(x)   (floor((x)+0.5f))
60#  define NO_FLOAT_MATH_LIB
61#  define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
62#endif
63
64#ifdef HAVE_ALLOCA_H
65#  include <alloca.h>
66#endif
67
68#ifdef USE_MEMORY_H
69#  include <memory.h>
70#endif
71
72#ifndef min
73#  define min(x,y)  ((x)>(y)?(y):(x))
74#endif
75
76#ifndef max
77#  define max(x,y)  ((x)<(y)?(y):(x))
78#endif
79
80#endif /* _OS_H */
81