can you help me to solve a problem with ZSTD library compression.
The thing is, when I tried to compress less than or equal to 4 bytes, the ZSTD_compress function returned me an exception
but if i change it from 4 bytes to 5 it will be fine
Please advise how to make ZSTD_compress to pack bytes less than 4 bytes and return the compressed size
i used zstd version 1.5.4
here's an example of what i did
#include <iostream>
#include <windows.h>
#include <assert.h>
#include "zstd.h"
#pragma comment(lib, "libzstd_static.lib")
int main() {
const size_t srcSize = 4;
char src[srcSize] = {0x0 ,0x0 ,0x0 ,0x0 };
size_t dstSize = srcSize + 12 + max(1, (srcSize + 12) / 1000);
char* dst = new char[dstSize];
size_t const countSize = ZSTD_compress((void*)dst, dstSize, (const void*)src, srcSize, 3);
if (ZSTD_isError(countSize)) {
assert(!ZSTD_isError(countSize));
}
}
I wanted ZSTD_compress to return me 17 bytes if src equals 4 bytes
how do I do this?