Skip to content
Snippets Groups Projects
Commit ca3e3ed1 authored by Dominik Loidolt's avatar Dominik Loidolt
Browse files

Fix decompression for sparc compiler

parent 0b5b76ba
Branches
Tags
1 merge request!28Updated debug_print(): Enhanced Adaptability for Various Environments
...@@ -106,8 +106,15 @@ static const uint32_t BIT_MASK[] = { ...@@ -106,8 +106,15 @@ static const uint32_t BIT_MASK[] = {
static __inline uint64_t bit_read_unaligned_64be(const void *ptr) 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; typedef __attribute__((aligned(1))) uint64_t unalign64;
return cpu_to_be64(*(const unalign64*)ptr); 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 ...@@ -184,7 +191,6 @@ static __inline size_t bit_init_decoder(struct bit_decoder *dec, const void *buf
* *
* @returns extracted value * @returns extracted value
*/ */
static __inline uint64_t bit_peek_bits(const struct bit_decoder *dec, unsigned int nb_bits) 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 */ /* mask for the shift value register to prevent undefined behaviour */
......
...@@ -53,7 +53,7 @@ void setUp(void) ...@@ -53,7 +53,7 @@ void setUp(void)
uint64_t seed; uint64_t seed;
static int n; static int n;
#if HAS_TIME_H #ifdef HAS_TIME_H
seed = (uint64_t)(time(NULL) ^ getpid() ^ (intptr_t)&setUp); seed = (uint64_t)(time(NULL) ^ getpid() ^ (intptr_t)&setUp);
#else #else
seed = 1; seed = 1;
...@@ -968,16 +968,15 @@ static int32_t chunk_round_trip(void *data, uint32_t data_size, ...@@ -968,16 +968,15 @@ static int32_t chunk_round_trip(void *data, uint32_t data_size,
* @test decompress_cmp_entiy * @test decompress_cmp_entiy
*/ */
void test_random_collection_round_trip(void)
void test_random_chunk_round_trip(void)
{ {
enum cmp_data_type data_type; enum cmp_data_type data_type;
enum cmp_mode cmp_mode; 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 *data = malloc(CMP_ENTITY_MAX_ORIGINAL_SIZE);
void *model = malloc(MAX_DATA_TO_COMPRESS_SIZE); void *model = malloc(MAX_DATA_TO_COMPRESS_SIZE);
void *updated_model = calloc(1, 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); void *cmp_data = malloc(cmp_data_capacity);
for (data_type = 1; data_type <= DATA_TYPE_F_CAM_BACKGROUND; data_type++) { for (data_type = 1; data_type <= DATA_TYPE_F_CAM_BACKGROUND; data_type++) {
......
#include <stddef.h> #include <stddef.h>
#include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment