2 ** Copyright (C) 2001 Erik de Castro Lopo <erikd AT mega-nerd DOT com>
4 ** Permission to use, copy, modify, distribute, and sell this file for any
5 ** purpose is hereby granted without fee, provided that the above copyright
6 ** and this permission notice appear in all copies. No representations are
7 ** made about the suitability of this software for any purpose. It is
8 ** provided "as is" without express or implied warranty.
14 /*============================================================================
15 ** On Intel Pentium processors (especially PIII and probably P4), converting
16 ** from float to int is very slow. To meet the C specs, the code produced by
17 ** most C compilers targeting Pentium needs to change the FPU rounding mode
18 ** before the float to int conversion is performed.
20 ** Changing the FPU rounding mode causes the FPU pipeline to be flushed. It
21 ** is this flushing of the pipeline which is so slow.
23 ** Fortunately the ISO C99 specifications define the functions lrint, lrintf,
24 ** llrint and llrintf which fix this problem as a side effect.
26 ** On Unix-like systems, the configure process should have detected the
27 ** presence of these functions. If they weren't found we have to replace them
28 ** here with a standard C cast.
32 ** The C99 prototypes for lrint and lrintf are as follows:
34 ** long int lrintf (float x) ;
35 ** long int lrint (double x) ;
37 #ifndef __FLOAT_CAST_H__ // Added by JE - 30-11-2009
38 #define __FLOAT_CAST_H__
39 #if (defined (WIN32) || defined (_WIN32))
43 /* Win32 doesn't seem to have these functions.
44 ** Therefore implement inline versions of these functions here.
71 __inline long long int
73 { long long int intgr;
83 __inline long long int
85 { long long int intgr;
96 #endif // __FLOAT_CAST_H__