Fixed : minor warnings under Visual 32 bits

This commit is contained in:
Yann Collet 2015-01-25 13:19:12 +01:00
parent a09347235f
commit fb81417323
2 changed files with 4 additions and 3 deletions

View File

@ -195,9 +195,9 @@ static void FSE_writeLE64(void* memPtr, U64 val64)
static size_t FSE_readLEST(const void* memPtr) static size_t FSE_readLEST(const void* memPtr)
{ {
if (sizeof(size_t)==4) if (sizeof(size_t)==4)
return FSE_readLE32(memPtr); return (size_t)FSE_readLE32(memPtr);
else else
return FSE_readLE64(memPtr); return (size_t)FSE_readLE64(memPtr);
} }
static void FSE_writeLEST(void* memPtr, size_t val) static void FSE_writeLEST(void* memPtr, size_t val)

View File

@ -382,7 +382,8 @@ static unsigned ZSTD_NbCommonBytes (register size_t val)
return (__builtin_clzll(val) >> 3); return (__builtin_clzll(val) >> 3);
# else # else
unsigned r; unsigned r;
if (!(val>>32)) { r=4; } else { r=0; val>>=32; } const unsigned n32 = sizeof(size_t)*4; /* calculate this way due to compiler complaining in 32-bits mode */
if (!(val>>n32)) { r=4; } else { r=0; val>>=n32; }
if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; } if (!(val>>16)) { r+=2; val>>=8; } else { val>>=24; }
r += (!val); r += (!val);
return r; return r;