small compression speed improvement

git-svn-id: https://lz4.googlecode.com/svn/trunk@18 650e7d94-2a16-8b24-b05c-7c0b3f6821cd
This commit is contained in:
yann.collet.73@gmail.com 2011-09-13 18:19:42 +00:00
parent 7c6229fb3d
commit 86a59c7a82

29
lz4.c
View File

@ -92,8 +92,8 @@ struct refTables
//**************************************
// Macros
//**************************************
#define HASH_FUNCTION(i) ((i * 2654435761U) >> ((MINMATCH*8)-HASH_LOG))
#define HASH_VALUE(p) HASH_FUNCTION(*(U32*)p)
#define HASH_FUNCTION(i) (((i) * 2654435761U) >> ((MINMATCH*8)-HASH_LOG))
#define HASH_VALUE(p) HASH_FUNCTION(*(U32*)(p))
@ -101,19 +101,6 @@ struct refTables
// Compression CODE
//****************************
int LZ4_compress(char* source,
char* dest,
int isize)
{
void* ctx = malloc(sizeof(struct refTables));
int result = LZ4_compressCtx(&ctx, source, dest, isize);
free(ctx);
return result;
}
int LZ4_compressCtx(void** ctx,
char* source,
char* dest,
@ -217,6 +204,18 @@ _endCount:
}
int LZ4_compress(char* source,
char* dest,
int isize)
{
void* ctx = malloc(sizeof(struct refTables));
int result = LZ4_compressCtx(&ctx, source, dest, isize);
free(ctx);
return result;
}
//****************************
// Decompression CODE