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