switch(flSize)
{
case 1: /* 2 - 1 - 5 */
- ostart[0] = (BYTE)((IS_RAW<<6) + (0<<5) + srcSize);
+ ostart[0] = (BYTE)((lbt_raw<<6) + (0<<5) + srcSize);
break;
case 2: /* 2 - 2 - 12 */
- ostart[0] = (BYTE)((IS_RAW<<6) + (2<<4) + (srcSize >> 8));
+ ostart[0] = (BYTE)((lbt_raw<<6) + (2<<4) + (srcSize >> 8));
ostart[1] = (BYTE)srcSize;
break;
default: /*note : should not be necessary : flSize is within {1,2,3} */
case 3: /* 2 - 2 - 20 */
- ostart[0] = (BYTE)((IS_RAW<<6) + (3<<4) + (srcSize >> 16));
+ ostart[0] = (BYTE)((lbt_raw<<6) + (3<<4) + (srcSize >> 16));
ostart[1] = (BYTE)(srcSize>>8);
ostart[2] = (BYTE)srcSize;
break;
switch(flSize)
{
case 1: /* 2 - 1 - 5 */
- ostart[0] = (BYTE)((IS_RLE<<6) + (0<<5) + srcSize);
+ ostart[0] = (BYTE)((lbt_rle<<6) + (0<<5) + srcSize);
break;
case 2: /* 2 - 2 - 12 */
- ostart[0] = (BYTE)((IS_RLE<<6) + (2<<4) + (srcSize >> 8));
+ ostart[0] = (BYTE)((lbt_rle<<6) + (2<<4) + (srcSize >> 8));
ostart[1] = (BYTE)srcSize;
break;
default: /*note : should not be necessary : flSize is necessarily within {1,2,3} */
case 3: /* 2 - 2 - 20 */
- ostart[0] = (BYTE)((IS_RLE<<6) + (3<<4) + (srcSize >> 16));
+ ostart[0] = (BYTE)((lbt_rle<<6) + (3<<4) + (srcSize >> 16));
ostart[1] = (BYTE)(srcSize>>8);
ostart[2] = (BYTE)srcSize;
break;
size_t const lhSize = 3 + (srcSize >= 1 KB) + (srcSize >= 16 KB);
BYTE* const ostart = (BYTE*)dst;
U32 singleStream = srcSize < 256;
- U32 hType = IS_HUF;
+ litBlockType_t hType = lbt_huffman;
size_t cLitSize;
if (dstCapacity < lhSize+1) return ERROR(dstSize_tooSmall); /* not enough space for compression */
if (zc->flagStaticTables && (lhSize==3)) {
- hType = IS_PCH;
+ hType = lbt_repeat;
singleStream = 1;
cLitSize = HUF_compress1X_usingCTable(ostart+lhSize, dstCapacity-lhSize, src, srcSize, zc->hufTable);
} else {
const void* src, size_t srcSize) /* note : srcSize < BLOCKSIZE */
{
const BYTE* const istart = (const BYTE*) src;
+ litBlockType_t lbt;
- /* any compressed block with literals segment must be at least this size */
if (srcSize < MIN_CBLOCK_SIZE) return ERROR(corruption_detected);
+ lbt = (litBlockType_t)(istart[0]>> 6);
- switch(istart[0]>> 6)
+ switch(lbt)
{
- case IS_HUF:
+ case lbt_huffman:
{ size_t litSize, litCSize, singleStream=0;
U32 lhSize = ((istart[0]) >> 4) & 3;
if (srcSize < 5) return ERROR(corruption_detected); /* srcSize >= MIN_CBLOCK_SIZE == 3; here we need up to 5 for lhSize, + cSize (+nbSeq) */
dctx->litSize = litSize;
return litCSize + lhSize;
}
- case IS_PCH:
+ case lbt_repeat:
{ size_t litSize, litCSize;
U32 lhSize = ((istart[0]) >> 4) & 3;
if (lhSize != 1) /* only case supported for now : small litSize, single stream */
dctx->litSize = litSize;
return litCSize + lhSize;
}
- case IS_RAW:
+ case lbt_raw:
{ size_t litSize;
U32 lhSize = ((istart[0]) >> 4) & 3;
switch(lhSize)
dctx->litSize = litSize;
return lhSize+litSize;
}
- case IS_RLE:
+ case lbt_rle:
{ size_t litSize;
U32 lhSize = ((istart[0]) >> 4) & 3;
switch(lhSize)
/*! ZSTD_createDDict() :
* Create a digested dictionary, ready to start decompression operation without startup delay.
-* `dict` can be released after creation */
+* `dict` can be released after `ZSTD_DDict` creation */
ZSTD_DDict* ZSTD_createDDict(const void* dict, size_t dictSize)
{
ZSTD_customMem const allocator = { NULL, NULL, NULL };
/*! ZSTD_decompress_usingDDict() :
* Decompression using a pre-digested Dictionary
-* In contrast with older ZSTD_decompress_usingDict(), use dictionary without significant overhead. */
+* Use dictionary without significant overhead. */
ZSTDLIB_API size_t ZSTD_decompress_usingDDict(ZSTD_DCtx* dctx,
void* dst, size_t dstCapacity,
const void* src, size_t srcSize,