/* LZ4F_makeBlock(): compress a single block, add header and checksum assumption : dst buffer capacity is >= srcSize  */
static size_t LZ4F_makeBlock(void *dst, const void *src, size_t srcSize, compressFunc_t compress, void *lz4ctx, int level, const LZ4F_CDict *cdict, LZ4F_blockChecksum_t crcFlag)
/* LZ4F_makeBlock(): compress a single block, add header and checksum assumption : dst buffer capacity is >= srcSize  */
static size_t LZ4F_makeBlock(void *dst, const void *src, size_t srcSize, compressFunc_t compress, void *lz4ctx, int level, const LZ4F_CDict *cdict, LZ4F_blockChecksum_t crcFlag)
{
    BYTE* const cSizePtr = (BYTE*)dst;
    U32 cSize = (U32)compress(lz4ctx, (const char*)src, (char*)(cSizePtr+4),
                                      (int)(srcSize), (int)(srcSize-1),
                                      level, cdict);
    LZ4F_writeLE32(cSizePtr, cSize);
    if (cSize == 0) {
        cSize = (U32)srcSize;
        LZ4F_writeLE32(cSizePtr, cSize | LZ4F_BLOCKUNCOMPRESSED_FLAG);
        memcpy(cSizePtr+4, src, srcSize);
    }
    if (crcFlag) {
        U32 const crc32 = XXH32(cSizePtr+4, cSize, 0);
        LZ4F_writeLE32(cSizePtr+4+cSize, crc32);
    }
    return 4 + cSize + ((U32)crcFlag)*4;
}