os.h 2.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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. function: #ifdef jail to whip a few platforms into the UNIX ideal.
  36. ************************************************************************/
  37. #include <math.h>
  38. #include "os_types.h"
  39. #ifndef _V_IFDEFJAIL_H_
  40. # define _V_IFDEFJAIL_H_
  41. # ifdef __GNUC__
  42. # define STIN static __inline__
  43. # elif _WIN32
  44. # define STIN static __inline
  45. # endif
  46. #else
  47. # define STIN static
  48. #endif
  49. #ifndef M_PI
  50. # define M_PI (3.1415926536f)
  51. #endif
  52. #ifdef _WIN32
  53. # include <malloc.h>
  54. # define rint(x) (floor((x)+0.5f))
  55. # define NO_FLOAT_MATH_LIB
  56. # define FAST_HYPOT(a, b) sqrt((a)*(a) + (b)*(b))
  57. #endif
  58. #ifdef HAVE_ALLOCA_H
  59. # include <alloca.h>
  60. #endif
  61. #ifdef USE_MEMORY_H
  62. # include <memory.h>
  63. #endif
  64. #ifndef min
  65. # define min(x,y) ((x)>(y)?(y):(x))
  66. #endif
  67. #ifndef max
  68. # define max(x,y) ((x)<(y)?(y):(x))
  69. #endif
  70. #endif /* _OS_H */