-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#include "algo-zstd.h" | ||
|
||
#include "zstd.h" | ||
|
||
static struct ZSTD_CCtx_s* cctx; | ||
static struct ZSTD_DCtx_s* dctx; | ||
|
||
void zstd_init() | ||
{ | ||
cctx = ZSTD_createCCtx(); | ||
dctx = ZSTD_createDCtx(); | ||
} | ||
|
||
void zstd_compress(uint8_t *input, size_t insize, uint8_t *output, size_t *outsize) | ||
{ | ||
*outsize = ZSTD_compressCCtx(cctx, output, *outsize, input, insize, 1); | ||
} | ||
|
||
void zstd_uncompress(uint8_t *input, size_t insize, uint8_t *output, size_t *outsize) | ||
{ | ||
*outsize = ZSTD_decompressDCtx(dctx, output, *outsize, input, insize); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#ifndef __ALGO_ZSTD_H__ | ||
#define __ALGO_ZSTD_H__ | ||
|
||
#include "pico/stdlib.h" | ||
|
||
void zstd_init(); | ||
void zstd_compress(uint8_t* input, size_t insize, uint8_t* output, size_t* outsize); | ||
void zstd_uncompress(uint8_t* input, size_t insize, uint8_t* output, size_t* outsize); | ||
|
||
#endif // __ALGO_ZSTD_H__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters