diff --git a/lib/decompress/read_bitstream.h b/lib/decompress/read_bitstream.h index c65090eac4074d12fcd087fa43d193c3c4ade4fa..f46804c1841315a5e7e912aea4da13fccbc84cf6 100644 --- a/lib/decompress/read_bitstream.h +++ b/lib/decompress/read_bitstream.h @@ -106,8 +106,15 @@ static const uint32_t BIT_MASK[] = { static __inline uint64_t bit_read_unaligned_64be(const void *ptr) { +#ifdef __sparc__ + uint64_t v; + memcpy(&v, ptr, sizeof(v)); + return cpu_to_be64(v); + +#else typedef __attribute__((aligned(1))) uint64_t unalign64; return cpu_to_be64(*(const unalign64*)ptr); +#endif } @@ -184,7 +191,6 @@ static __inline size_t bit_init_decoder(struct bit_decoder *dec, const void *buf * * @returns extracted value */ - static __inline uint64_t bit_peek_bits(const struct bit_decoder *dec, unsigned int nb_bits) { /* mask for the shift value register to prevent undefined behaviour */ diff --git a/test/cmp_decmp/test_cmp_decmp.c b/test/cmp_decmp/test_cmp_decmp.c index ae53c8ac6927cfc42cd2a027b43f9d35af3f9094..ead45c4ca3ca15277d036b4514168e68f3609483 100644 --- a/test/cmp_decmp/test_cmp_decmp.c +++ b/test/cmp_decmp/test_cmp_decmp.c @@ -53,7 +53,7 @@ void setUp(void) uint64_t seed; static int n; -#if HAS_TIME_H +#ifdef HAS_TIME_H seed = (uint64_t)(time(NULL) ^ getpid() ^ (intptr_t)&setUp); #else seed = 1; @@ -968,16 +968,15 @@ static int32_t chunk_round_trip(void *data, uint32_t data_size, * @test decompress_cmp_entiy */ - -void test_random_chunk_round_trip(void) +void test_random_collection_round_trip(void) { enum cmp_data_type data_type; enum cmp_mode cmp_mode; - enum { MAX_DATA_TO_COMPRESS_SIZE = CMP_ENTITY_MAX_ORIGINAL_SIZE}; + enum { MAX_DATA_TO_COMPRESS_SIZE = UINT16_MAX}; + uint32_t cmp_data_capacity = COMPRESS_CHUNK_BOUND(MAX_DATA_TO_COMPRESS_SIZE, 1); void *data = malloc(CMP_ENTITY_MAX_ORIGINAL_SIZE); void *model = malloc(MAX_DATA_TO_COMPRESS_SIZE); void *updated_model = calloc(1, MAX_DATA_TO_COMPRESS_SIZE); - uint32_t cmp_data_capacity = CMP_ENTITY_MAX_SIZE-NON_IMAGETTE_HEADER_SIZE; void *cmp_data = malloc(cmp_data_capacity); for (data_type = 1; data_type <= DATA_TYPE_F_CAM_BACKGROUND; data_type++) { diff --git a/test/test_common/test_common.c b/test/test_common/test_common.c index b2be771719f0f768dcb965faad4b47df5b4ebc7e..4f90832be876c6d41c2f386d9911ff5b4034f606 100644 --- a/test/test_common/test_common.c +++ b/test/test_common/test_common.c @@ -1,4 +1,5 @@ #include <stddef.h> +#include <stdint.h> #include <stdlib.h> #include <string.h>