mirror of
https://github.com/opencv/opencv.git
synced 2026-09-13 05:42:51 -05:00
imgproc: fix trailingZeros for MSVS 2010
This commit is contained in:
@@ -50,10 +50,15 @@
|
|||||||
static const CvPoint icvCodeDeltas[8] =
|
static const CvPoint icvCodeDeltas[8] =
|
||||||
{ CvPoint(1, 0), CvPoint(1, -1), CvPoint(0, -1), CvPoint(-1, -1), CvPoint(-1, 0), CvPoint(-1, 1), CvPoint(0, 1), CvPoint(1, 1) };
|
{ CvPoint(1, 0), CvPoint(1, -1), CvPoint(0, -1), CvPoint(-1, -1), CvPoint(-1, 0), CvPoint(-1, 1), CvPoint(0, 1), CvPoint(1, 1) };
|
||||||
|
|
||||||
|
#if CV_SSE2
|
||||||
|
static
|
||||||
inline unsigned int trailingZeros(unsigned int value) {
|
inline unsigned int trailingZeros(unsigned int value) {
|
||||||
|
CV_DbgAssert(value != 0); // undefined for zero input (https://en.wikipedia.org/wiki/Find_first_set)
|
||||||
#if defined(_MSC_VER)
|
#if defined(_MSC_VER)
|
||||||
#if (_MSC_VER < 1500)
|
#if (_MSC_VER < 1700)
|
||||||
return _BitScanForward(value);
|
unsigned long index = 0;
|
||||||
|
_BitScanForward(&index, value);
|
||||||
|
return (unsigned int)index;
|
||||||
#else
|
#else
|
||||||
return _tzcnt_u32(value);
|
return _tzcnt_u32(value);
|
||||||
#endif
|
#endif
|
||||||
@@ -70,6 +75,7 @@ inline unsigned int trailingZeros(unsigned int value) {
|
|||||||
return MultiplyDeBruijnBitPosition[((uint32_t)((value & -value) * 0x077CB531U)) >> 27];
|
return MultiplyDeBruijnBitPosition[((uint32_t)((value & -value) * 0x077CB531U)) >> 27];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
CV_IMPL void
|
CV_IMPL void
|
||||||
cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader )
|
cvStartReadChainPoints( CvChain * chain, CvChainPtReader * reader )
|
||||||
|
|||||||
Reference in New Issue
Block a user