| 1 | #ifndef _vorbis_os_h_ |
| 2 | #define _vorbis_os_h_ |
| 3 | /******************************************************************** |
| 4 | * * |
| 5 | * THIS FILE IS PART OF THE OggVorbis SOFTWARE CODEC SOURCE CODE. * |
| 6 | * USE, DISTRIBUTION AND REPRODUCTION OF THIS LIBRARY SOURCE IS * |
| 7 | * GOVERNED BY A BSD-STYLE SOURCE LICENSE INCLUDED WITH THIS SOURCE * |
| 8 | * IN 'COPYING'. PLEASE READ THESE TERMS BEFORE DISTRIBUTING. * |
| 9 | * * |
| 10 | * THE OggVorbis SOURCE CODE IS (C) COPYRIGHT 1994-2015 * |
| 11 | * by the Xiph.Org Foundation https://xiph.org/ * |
| 12 | * * |
| 13 | ******************************************************************** |
| 14 | |
| 15 | function: #ifdef jail to whip a few platforms into the UNIX ideal. |
| 16 | |
| 17 | ********************************************************************/ |
| 18 | |
| 19 | #ifdef HAVE_CONFIG_H |
| 20 | #include "config.h" |
| 21 | #endif |
| 22 | |
| 23 | #include <math.h> |
| 24 | #include "config_types.h" |
| 25 | |
| 26 | #include "vorbis_misc.h" |
| 27 | |
| 28 | #ifndef _V_IFDEFJAIL_H_ |
| 29 | # define _V_IFDEFJAIL_H_ |
| 30 | |
| 31 | #ifndef M_PI |
| 32 | # define M_PI (3.1415926536f) |
| 33 | #endif |
| 34 | |
| 35 | #endif /* _V_IFDEFJAIL_H_ */ |
| 36 | |
| 37 | #ifdef HAVE_ALLOCA_H |
| 38 | # include <alloca.h> |
| 39 | #endif |
| 40 | |
| 41 | #ifdef USE_MEMORY_H |
| 42 | # include <memory.h> |
| 43 | #endif |
| 44 | |
| 45 | #if defined(__WINS__) |
| 46 | # define alloca _alloca |
| 47 | #endif |
| 48 | |
| 49 | |
| 50 | typedef int vorbis_fpu_control; |
| 51 | |
| 52 | static inline int vorbis_ftoi(double f){ |
| 53 | /* Note: MSVC and GCC (at least on some systems) round towards zero, thus, |
| 54 | the floor() call is required to ensure correct roudning of |
| 55 | negative numbers */ |
| 56 | return (int)floor(f+.5); |
| 57 | } |
| 58 | |
| 59 | /* We don't have special code for this compiler/arch, so do it the slow way */ |
| 60 | # define vorbis_fpu_setround(vorbis_fpu_control) {} |
| 61 | # define vorbis_fpu_restore(vorbis_fpu_control) {} |
| 62 | |
| 63 | |
| 64 | #endif /* _vorbis_os_h_ */ |