Merge pull request #499 from vpisarev:zeroelem_fix

This commit is contained in:
Andrey Kamaev 2013-02-18 18:05:02 +04:00 committed by OpenCV Buildbot
commit 39baa2237e

View File

@ -3496,7 +3496,7 @@ enum { HASH_SIZE0 = 8 };
static inline void copyElem(const uchar* from, uchar* to, size_t elemSize) static inline void copyElem(const uchar* from, uchar* to, size_t elemSize)
{ {
size_t i; size_t i;
for( i = 0; (int)i <= (int)(elemSize - sizeof(int)); i += sizeof(int) ) for( i = 0; i + sizeof(int) <= elemSize; i += sizeof(int) )
*(int*)(to + i) = *(const int*)(from + i); *(int*)(to + i) = *(const int*)(from + i);
for( ; i < elemSize; i++ ) for( ; i < elemSize; i++ )
to[i] = from[i]; to[i] = from[i];
@ -3505,7 +3505,7 @@ static inline void copyElem(const uchar* from, uchar* to, size_t elemSize)
static inline bool isZeroElem(const uchar* data, size_t elemSize) static inline bool isZeroElem(const uchar* data, size_t elemSize)
{ {
size_t i; size_t i;
for( i = 0; i <= elemSize - sizeof(int); i += sizeof(int) ) for( i = 0; i + sizeof(int) <= elemSize; i += sizeof(int) )
if( *(int*)(data + i) != 0 ) if( *(int*)(data + i) != 0 )
return false; return false;
for( ; i < elemSize; i++ ) for( ; i < elemSize; i++ )