use compiler intrinsics for windows x64 build (FSBUILD-131)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12246 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
ccb556ba48
commit
843a1da0b2
|
@ -41,7 +41,7 @@
|
||||||
#include "syntFilter.h"
|
#include "syntFilter.h"
|
||||||
|
|
||||||
#if (defined(WIN32) || defined(_WIN32)) && !defined(_WIN64)
|
#if (defined(WIN32) || defined(_WIN32)) && !defined(_WIN64)
|
||||||
__inline double rint(double dbl)
|
__inline long int rint(double dbl)
|
||||||
{
|
{
|
||||||
_asm
|
_asm
|
||||||
{
|
{
|
||||||
|
@ -50,9 +50,15 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined (_WIN64)
|
#elif defined (_WIN64)
|
||||||
|
#include <intrin.h>
|
||||||
__inline__ long int rint(double x)
|
__inline__ long int rint(double x)
|
||||||
{
|
{
|
||||||
|
#ifdef _M_X64
|
||||||
|
return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
|
||||||
|
#else
|
||||||
|
#warning "Not Supported: Replacing with a simple C cast."
|
||||||
return (long int) (x);
|
return (long int) (x);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -303,29 +303,26 @@ extern "C"
|
||||||
}
|
}
|
||||||
#elif defined(WIN64) || defined(_WIN64)
|
#elif defined(WIN64) || defined(_WIN64)
|
||||||
/* x86_64 machines will do best with a simple assignment. */
|
/* x86_64 machines will do best with a simple assignment. */
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
__inline long int lrint(double x)
|
__inline long int lrint(double x)
|
||||||
{
|
{
|
||||||
long int i;
|
#ifdef _M_X64
|
||||||
|
return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
|
||||||
_asm
|
#else
|
||||||
{
|
#warning "Not Supported: Replacing with a simple C cast."
|
||||||
fld x
|
return (long int) (x);
|
||||||
fistp i
|
#endif
|
||||||
};
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline long int lrintf(float x)
|
__inline long int lrintf(float x)
|
||||||
{
|
{
|
||||||
long int i;
|
#ifdef _M_X64
|
||||||
|
return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
|
||||||
_asm
|
#else
|
||||||
{
|
#warning "Not Supported: Replacing with a simple C cast."
|
||||||
fld x
|
return (long int) (x);
|
||||||
fistp i
|
#endif
|
||||||
};
|
|
||||||
return i;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
__inline long int lfastrint(double x)
|
__inline long int lfastrint(double x)
|
||||||
|
|
|
@ -127,17 +127,34 @@ __inline long lrintf (float flt)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
#elif defined(_WIN64)
|
#elif defined(_WIN64)
|
||||||
|
#include <intrin.h>
|
||||||
|
|
||||||
__inline__ long int rint(double x)
|
__inline__ long int rint(double x)
|
||||||
{
|
{
|
||||||
|
#ifdef _M_X64
|
||||||
|
return (long int)_mm_cvtsd_si64x( _mm_loadu_pd ((const double*)&x) );
|
||||||
|
#else
|
||||||
|
#warning "Not Supported: Replacing with a simple C cast."
|
||||||
return (long int) (x);
|
return (long int) (x);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
__inline__ int rintf(float x)
|
__inline__ int rintf(float x)
|
||||||
{
|
{
|
||||||
return (int) rint((double) x);
|
#ifdef _M_X64
|
||||||
|
return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
|
||||||
|
#else
|
||||||
|
#warning "Not Supported: Replacing with a simple C cast."
|
||||||
|
return (int) (x);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
__inline__ long int lrintf(float x)
|
__inline__ long int lrintf(float x)
|
||||||
{
|
{
|
||||||
|
#ifdef _M_X64
|
||||||
|
return _mm_cvt_ss2si( _mm_load_ss((const float*)&x) );
|
||||||
|
#else
|
||||||
|
#warning "Not Supported: Replacing with a simple C cast."
|
||||||
return (long int) (x);
|
return (long int) (x);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue