fix : HC streaming mode

This commit is contained in:
Yann Collet 2014-08-01 19:10:21 +01:00
parent 17fdc54813
commit 7ac18ad9dc
2 changed files with 5 additions and 1 deletions

1
NEWS
View File

@ -1,5 +1,6 @@
r121:
Added : Makefile : install for kFreeBSD and Hurd (Nobuhiro Iwamatsu)
Fix : Makefile : install for OS-X and BSD, thanks to Takayuki Matsuoka
r120:
Modified : Streaming API, using strong types

View File

@ -400,7 +400,10 @@ FORCE_INLINE void LZ4HC_Insert (LZ4HC_Data_Structure* hc4, const BYTE* ip)
char* LZ4_slideInputBufferHC(void* LZ4HC_Data)
{
LZ4HC_Data_Structure* hc4 = (LZ4HC_Data_Structure*)LZ4HC_Data;
U32 distance = (U32)(hc4->end - hc4->inputBuffer) - 64 KB;
size_t distance = (hc4->end - 64 KB) - hc4->inputBuffer;
if (hc4->end <= hc4->inputBuffer + 64 KB) return (char*)(hc4->end); /* no update : less than 64KB within buffer */
distance = (distance >> 16) << 16; /* Must be a multiple of 64 KB */
LZ4HC_Insert(hc4, hc4->end - MINMATCH);
memcpy((void*)(hc4->end - 64 KB - distance), (const void*)(hc4->end - 64 KB), 64 KB);