Fixed Calc_Hist under 32-bit gcc

This commit is contained in:
Andrey Kamaev 2012-04-18 16:16:54 +00:00
parent 423b721d97
commit 68aec288c0
2 changed files with 11 additions and 9 deletions

View File

@ -317,16 +317,19 @@ CV_INLINE int cvRound( double value )
#endif
}
#if defined __SSE2__ || (defined _M_IX86_FP && 2 == _M_IX86_FP)
#include "emmintrin.h"
#endif
CV_INLINE int cvFloor( double value )
{
#ifdef __GNUC__
int i = (int)value;
return i - (i > value);
#elif defined _MSC_VER && defined _M_X64
#if defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__)
__m128d t = _mm_set_sd( value );
int i = _mm_cvtsd_si32(t);
return i - _mm_movemask_pd(_mm_cmplt_sd(t, _mm_cvtsi32_sd(t,i)));
#elif defined __GNUC__
int i = (int)value;
return i - (i > value);
#else
int i = cvRound(value);
Cv32suf diff;
@ -338,13 +341,13 @@ CV_INLINE int cvFloor( double value )
CV_INLINE int cvCeil( double value )
{
#ifdef __GNUC__
int i = (int)value;
return i + (i < value);
#elif defined _MSC_VER && defined _M_X64
#if defined _MSC_VER && defined _M_X64 || (defined __GNUC__ && defined __SSE2__)
__m128d t = _mm_set_sd( value );
int i = _mm_cvtsd_si32(t);
return i + _mm_movemask_pd(_mm_cmplt_sd(_mm_cvtsi32_sd(t,i), t));
#elif defined __GNUC__
int i = (int)value;
return i + (i < value);
#else
int i = cvRound(value);
Cv32suf diff;

View File

@ -240,7 +240,6 @@ static void randf_32f( float* arr, int len, uint64* state, const Vec2f* p, bool
for( ; i < len; i++ )
{
temp = RNG_NEXT(temp);
arr[i] = (int)temp*p[i][0] + p[i][1];
#if defined __SSE2__ || (defined _M_IX86_FP && 2 == _M_IX86_FP)
_mm_store_ss(arr + i, _mm_add_ss(
_mm_mul_ss(_mm_set_ss((float)(int)temp), _mm_set_ss(p[i][0])),