added ZSTD_createDDict_byReference() body
This commit is contained in:
parent
4e5eea61a8
commit
0819abe3c1
@ -39,7 +39,7 @@ extern "C" {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* code only tested on 32 and 64 bits systems */
|
/* code only tested on 32 and 64 bits systems */
|
||||||
#define MEM_STATIC_ASSERT(c) { enum { XXH_static_assert = 1/(int)(!!(c)) }; }
|
#define MEM_STATIC_ASSERT(c) { enum { MEM_static_assert = 1/(int)(!!(c)) }; }
|
||||||
MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) || (sizeof(size_t)==8)); }
|
MEM_STATIC void MEM_check(void) { MEM_STATIC_ASSERT((sizeof(size_t)==4) || (sizeof(size_t)==8)); }
|
||||||
|
|
||||||
|
|
||||||
|
@ -1766,6 +1766,18 @@ ZSTD_DDict* ZSTD_createDDict(const void* dict, size_t dictSize)
|
|||||||
return ZSTD_createDDict_advanced(dict, dictSize, 0, allocator);
|
return ZSTD_createDDict_advanced(dict, dictSize, 0, allocator);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*! ZSTD_createDDict_byReference() :
|
||||||
|
* Create a digested dictionary, ready to start decompression operation without startup delay.
|
||||||
|
* Dictionary content is simply referenced, and therefore stays in dictBuffer.
|
||||||
|
* It is important that dictBuffer outlives DDict, it must remain read accessible throughout the lifetime of DDict */
|
||||||
|
ZSTD_DDict* ZSTD_createDDict_byReference(const void* dictBuffer, size_t dictSize)
|
||||||
|
{
|
||||||
|
ZSTD_customMem const allocator = { NULL, NULL, NULL };
|
||||||
|
return ZSTD_createDDict_advanced(dictBuffer, dictSize, 1, allocator);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
size_t ZSTD_freeDDict(ZSTD_DDict* ddict)
|
size_t ZSTD_freeDDict(ZSTD_DDict* ddict)
|
||||||
{
|
{
|
||||||
if (ddict==NULL) return 0; /* support free on NULL */
|
if (ddict==NULL) return 0; /* support free on NULL */
|
||||||
|
@ -306,13 +306,13 @@ static dictItem ZDICT_analyzePos(
|
|||||||
} while (length >=MINMATCHLENGTH);
|
} while (length >=MINMATCHLENGTH);
|
||||||
|
|
||||||
/* look backward */
|
/* look backward */
|
||||||
length = MINMATCHLENGTH;
|
length = MINMATCHLENGTH;
|
||||||
while ((length >= MINMATCHLENGTH) & (start > 0)) {
|
while ((length >= MINMATCHLENGTH) & (start > 0)) {
|
||||||
length = ZDICT_count(b + pos, b + suffix[start - 1]);
|
length = ZDICT_count(b + pos, b + suffix[start - 1]);
|
||||||
if (length >= LLIMIT) length = LLIMIT - 1;
|
if (length >= LLIMIT) length = LLIMIT - 1;
|
||||||
lengthList[length]++;
|
lengthList[length]++;
|
||||||
if (length >= MINMATCHLENGTH) start--;
|
if (length >= MINMATCHLENGTH) start--;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* largest useful length */
|
/* largest useful length */
|
||||||
memset(cumulLength, 0, sizeof(cumulLength));
|
memset(cumulLength, 0, sizeof(cumulLength));
|
||||||
|
Loading…
Reference in New Issue
Block a user