]> rtime.felk.cvut.cz Git - opencv.git/commitdiff
fixed cvRound implementation for MSVC on 32-bit Windows
authorvp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Mon, 5 Apr 2010 12:02:07 +0000 (12:02 +0000)
committervp153 <vp153@73c94f0f-984f-4a5f-82bc-2d8db8d8ee08>
Mon, 5 Apr 2010 12:02:07 +0000 (12:02 +0000)
git-svn-id: https://code.ros.org/svn/opencv/trunk@2984 73c94f0f-984f-4a5f-82bc-2d8db8d8ee08

opencv/include/opencv/cxtypes.h

index e43f5edf7695a94ed533de22336700aa0ff37d9e..110219cc2265e00e842bc13db2806fd98600646f 100644 (file)
@@ -216,7 +216,7 @@ CV_INLINE  int  cvRound( double value )
 #if (defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && !defined __APPLE__)
     __m128d t = _mm_set_sd( value );
     return _mm_cvtsd_si32(t);
-#elif defined _MSC_VER && defined _M_X86
+#elif defined _MSC_VER && defined _M_IX86
     int t;
     __asm
     {
@@ -228,7 +228,7 @@ CV_INLINE  int  cvRound( double value )
     return (int)lrint(value);
 #else
     // while this is not IEEE754-compliant rounding, it's usually a good enough approximation
-    return (int)(value + 0.5);
+    return (int)(value + (value >= 0 ? 0.5 : -0.5));
 #endif
 }