From d43a671e34d38706fdea65309b571cf64f0a5af3 Mon Sep 17 00:00:00 2001 From: x Date: Wed, 7 Jun 2023 13:58:23 +0200 Subject: [PATCH] TurboPFor: Variable simple c/c++ header --- .../lib/include_/vsimple.h | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 TurboPFor-Integer-Compression/lib/include_/vsimple.h diff --git a/TurboPFor-Integer-Compression/lib/include_/vsimple.h b/TurboPFor-Integer-Compression/lib/include_/vsimple.h new file mode 100644 index 0000000..decbc85 --- /dev/null +++ b/TurboPFor-Integer-Compression/lib/include_/vsimple.h @@ -0,0 +1,30 @@ +// -- "Integer Compression" variable simple "SimpleV" ----------------------------------------------------------- +// this belongs to the integer compression known as "simple family", like simple-9,simple-16 +// or simple-8b. SimpleV is compressing integers in groups into variable word size 32, 40 and 64 bits + RLE (run length encoding) +// SimpleV is faster than simple-16 and compress better than simple-16 or simple-8b. + +#ifdef __cplusplus +extern "C" { +#endif + +size_t vsbound8( size_t n); +size_t vsbound16(size_t n); +size_t vsbound32(size_t n); +size_t vsbound64(size_t n); + +// vsencNN: compress array with n unsigned (NN bits in[n]) values to the buffer out. Return value = end of compressed output buffer out +unsigned char *vsenc8( unsigned char *__restrict in, size_t n, unsigned char *__restrict out); +unsigned char *vsenc16(unsigned short *__restrict in, size_t n, unsigned char *__restrict out); +unsigned char *vsenc32(unsigned *__restrict in, size_t n, unsigned char *__restrict out); +unsigned char *vsenc64(uint64_t *__restrict in, size_t n, unsigned char *__restrict out); + +// vsdecNN: decompress buffer into an array of n unsigned values. Return value = end of compressed input buffer in +unsigned char *vsdec8( unsigned char *__restrict in, size_t n, unsigned char *__restrict out); +unsigned char *vsdec16(unsigned char *__restrict in, size_t n, unsigned short *__restrict out); +unsigned char *vsdec32(unsigned char *__restrict in, size_t n, unsigned *__restrict out); +unsigned char *vsdec64(unsigned char *__restrict in, size_t n, uint64_t *__restrict out); + +#ifdef __cplusplus +} +#endif +