#include <stdio.h>
#include <stdlib.h>
#include <cassert>
#include <vector>
#include "thirdparty/streamvbyte/include/streamvbyte.h"
auto main(int argc, char* argv[]) -> int {
auto test = std::vector<uint32_t>{431, 292, 979, 994, 761, 879, 672, 690, 296, 931, 379,
98, 132, 105, 116, 841, 387, 831, 335, 333, 557, 915};
// streamvbyte/examples/example.c
uint32_t N = test.size();
uint32_t* datain = static_cast<uint32_t*>(malloc(N * sizeof(uint32_t)));
uint8_t* compressedbuffer = static_cast<uint8_t*>(malloc(streamvbyte_max_compressedbytes(N)));
uint32_t* recovdata = static_cast<uint32_t*>(malloc(N * sizeof(uint32_t)));
for (uint32_t k = 0; k < N; ++k) datain[k] = test[k];
size_t compsize = streamvbyte_encode(datain, N, compressedbuffer); // encoding
// here the result is stored in compressedbuffer using compsize bytes
size_t compsize2 = streamvbyte_decode(compressedbuffer, recovdata,
N); // decoding (fast)
assert(compsize == compsize2);
free(datain);
free(compressedbuffer);
free(recovdata);
printf("Compressed %d integers down to %d bytes.\n", N, (int)compsize);
}
/home/moyi/thirdparty/streamvbyte/src/streamvbyte_x64_encode.c:91:3: runtime error: store to misaligned address 0x50b000001032 for type 'uint32_t' (aka 'unsigned int'), which requires 4 byte alignment
0x50b000001032: note: pointer points here
69 74 49 03 00 00 00 00 00 00 00 00 00 00 00 be be be be be be be be be be be be be be be be be
^
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior /home/moyi/thirdparty/streamvbyte/src/streamvbyte_x64_encode.c:91:3 in