Updated FSE
This commit is contained in:
@@ -135,7 +135,7 @@ typedef signed long long S64;
|
|||||||
* Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable).
|
* Method 1 : `__packed` statement. It depends on compiler extension (ie, not portable).
|
||||||
* This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`.
|
* This method is safe if your compiler supports it, and *generally* as fast or faster than `memcpy`.
|
||||||
* Method 2 : direct access. This method is portable but violate C standard.
|
* Method 2 : direct access. This method is portable but violate C standard.
|
||||||
* It can generate buggy code on targets which generate assembly depending on alignment.
|
* It can generate buggy code on targets generating assembly depending on alignment.
|
||||||
* But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6)
|
* But in some circumstances, it's the only known way to get the most performance (ie GCC + ARMv6)
|
||||||
* See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details.
|
* See http://fastcompression.blogspot.fr/2015/08/accessing-unaligned-memory.html for details.
|
||||||
* Prefer these methods in priority order (0 > 1 > 2)
|
* Prefer these methods in priority order (0 > 1 > 2)
|
||||||
@@ -1398,6 +1398,7 @@ size_t FSE_compress2 (void* dst, size_t dstSize, const void* src, size_t srcSize
|
|||||||
errorCode = FSE_count (count, &maxSymbolValue, ip, srcSize);
|
errorCode = FSE_count (count, &maxSymbolValue, ip, srcSize);
|
||||||
if (FSE_isError(errorCode)) return errorCode;
|
if (FSE_isError(errorCode)) return errorCode;
|
||||||
if (errorCode == srcSize) return 1;
|
if (errorCode == srcSize) return 1;
|
||||||
|
if (errorCode == 1) return 0; /* each symbol only present once */
|
||||||
if (errorCode < (srcSize >> 7)) return 0; /* Heuristic : not compressible enough */
|
if (errorCode < (srcSize >> 7)) return 0; /* Heuristic : not compressible enough */
|
||||||
|
|
||||||
tableLog = FSE_optimalTableLog(tableLog, srcSize, maxSymbolValue);
|
tableLog = FSE_optimalTableLog(tableLog, srcSize, maxSymbolValue);
|
||||||
@@ -1534,7 +1535,7 @@ static size_t FSE_lookBits(FSE_DStream_t* bitD, U32 nbBits)
|
|||||||
|
|
||||||
static size_t FSE_lookBitsFast(FSE_DStream_t* bitD, U32 nbBits) /* only if nbBits >= 1 !! */
|
static size_t FSE_lookBitsFast(FSE_DStream_t* bitD, U32 nbBits) /* only if nbBits >= 1 !! */
|
||||||
{
|
{
|
||||||
return (bitD->bitContainer << bitD->bitsConsumed) >> ((sizeof(bitD->bitContainer)*8)-nbBits);
|
return (bitD->bitContainer << (bitD->bitsConsumed & ((sizeof(bitD->bitContainer)*8)-1))) >> ((sizeof(bitD->bitContainer)*8)-nbBits);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void FSE_skipBits(FSE_DStream_t* bitD, U32 nbBits)
|
static void FSE_skipBits(FSE_DStream_t* bitD, U32 nbBits)
|
||||||
|
|||||||
Reference in New Issue
Block a user