View | Details | Raw Unified | Return to bug 210505 | Differences between
and this patch

Collapse All | Expand All

(-)modules/core/include/opencv2/core/types_c.h (+32 lines)
Lines 197-202 Link Here
197
#define cvInvSqrt(value) ((float)(1./sqrt(value)))
197
#define cvInvSqrt(value) ((float)(1./sqrt(value)))
198
#define cvSqrt(value)  ((float)sqrt(value))
198
#define cvSqrt(value)  ((float)sqrt(value))
199
199
200
#ifndef __cplusplus
201
CV_INLINE int cvRound(float value)
202
{
203
#if ((defined _MSC_VER && defined _M_X64) || (defined __GNUC__ && defined __x86_64__ && \
204
      defined __SSE2__ && !defined __APPLE__)) && !defined(__CUDACC__)
205
    __m128 t = _mm_set_ss( value );
206
    return _mm_cvtss_si32(t);
207
#elif defined _MSC_VER && defined _M_IX86
208
    int t;
209
    __asm
210
    {
211
        fld value;
212
        fistp t;
213
    }
214
    return t;
215
#elif ((defined _MSC_VER && defined _M_ARM) || defined CV_ICC || \
216
        defined __GNUC__) && defined HAVE_TEGRA_OPTIMIZATION
217
    TEGRA_ROUND_FLT(value);
218
#elif defined CV_ICC || defined __GNUC__
219
# if CV_VFP
220
    ARM_ROUND_FLT(value);
221
# else
222
    return (int)lrintf(value);
223
# endif
224
#else
225
    /* it's ok if round does not comply with IEEE754 standard;
226
     the tests should allow +/-1 difference when the tested functions use round */
227
    return (int)(value + (value >= 0 ? 0.5f : -0.5f));
228
#endif
229
}
230
#endif
231
200
232
201
/*************** Random number generation *******************/
233
/*************** Random number generation *******************/
202
234

Return to bug 210505