Parolin 0.7.9 6796
Console (soon DLLs) to do a tar like job
Loading...
Searching...
No Matches
simple.c File Reference
#include <stddef.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "../zstddeclib.c"
#include "testcard-dxt1.inl"
#include "testcard-zstd.inl"

Functions

size_t ZSTD_decompress (void *dst, size_t dstLen, const void *src, size_t srcLen)
 
int main ()
 

Detailed Description

Simple standalone example of using the single-file zstddeclib.

Note
In this simple example we include the amalgamated source and compile just this single file, but we could equally (and more conventionally) include zstd.h and compile both this file and zstddeclib.c (the resulting binaries differ slightly in size but perform the same).
Author
Carl Woffenden, Numfum GmbH (released under a CC0 license)

Function Documentation

◆ main()

int main ( void )

Simple single-file test to decompress srcZstd into # dstDxt1 then compare the resulting bytes with rawDxt1.
As a (naive) comparison, removing Zstd and building with "-Os -g0 simple.c" results in a 44kB binary (macOS 10.14, Clang 10); re-adding Zstd increases the binary by 56kB (after calling strip).

◆ ZSTD_decompress()

size_t ZSTD_decompress ( void * dst,
size_t dstLen,
const void * src,
size_t srcLen )

For the case where the decompression library hasn't been included we add a dummy function to fake the process and stop the buffers being optimised out.