Repository Details
Shared by
HelloGitHub Rating
0 ratings
快速、无损的数据压缩算法 Zstandard 的 C 语言实现
Past 6 days Received 36 stars ✨
Use arrow keys to explore dates, Home and End for the first and last date, Escape to dismiss.| Date | Star | Daily change |
|---|---|---|
| 周二 | 28,219 | — |
| 周三 | 28,235 | +16 |
| 周四 | 28,250 | +15 |
| 周五 | 28,245 | -5 |
| 周六 | 28,252 | +7 |
| 周日 | 28,255 | +3 |
28.3k
Stars
No
Chinese
C
Language
Yes
Active
429
Contributors
432
Issues
Yes
Organization
None
Latest
3k
Forks
None
License

快速、无损的数据压缩算法 Zstandard 的实现。Zstd 的压缩比接近 lzma、lzham 和 ppmx,并且比 lza 或 bzip2 性能更好。在相似的压缩比情况下,它解压缩的速度比其他的算法都要快。很多知名项目和游戏都有这个算法的身影,示例代码:
```c
static void compress_orDie(const char* fname, const char* oname)
{
size_t fSize;
void* const fBuff = mallocAndLoadFile_orDie(fname, &fSize);
size_t const cBuffSize = ZSTD_compressBound(fSize);
void* const cBuff = malloc_orDie(cBuffSize);
/* Compress.
* If you are doing many compressions, you may want to reuse the context.
* See the multiple_simple_compression.c example.
*/
size_t const cSize = ZSTD_compress(cBuff, cBuffSize, fBuff, fSize, 1);
CHECK_ZSTD(cSize);
saveFile_orDie(oname, cBuff, cSize);
/* success */
printf("%25s : %6u -> %7u - %s \n", fname, (unsigned)fSize, (unsigned)cSize, oname);
free(fBuff);
free(cBuff);
}
```
Comments
Rating:
No comments yet