Fixed some issues with unsigned comparisons

master
Ismael Gomez 9 years ago
parent 027d5efa63
commit 82d55bde4f

@ -43,7 +43,7 @@
typedef struct SRSLTE_API { typedef struct SRSLTE_API {
uint32_t R; uint32_t R;
uint32_t K; uint32_t K;
uint32_t poly[3]; int poly[3];
bool tail_biting; bool tail_biting;
}srslte_convcoder_t; }srslte_convcoder_t;

@ -55,7 +55,6 @@ typedef struct SRSLTE_API{
uint32_t framebits; uint32_t framebits;
bool tail_biting; bool tail_biting;
float gain_quant; float gain_quant;
uint32_t poly[3];
int (*decode) (void*, uint8_t*, uint8_t*, uint32_t); int (*decode) (void*, uint8_t*, uint8_t*, uint32_t);
int (*decode_f) (void*, float*, uint8_t*, uint32_t); int (*decode_f) (void*, float*, uint8_t*, uint32_t);
void (*free) (void*); void (*free) (void*);
@ -65,7 +64,7 @@ typedef struct SRSLTE_API{
SRSLTE_API int srslte_viterbi_init(srslte_viterbi_t *q, SRSLTE_API int srslte_viterbi_init(srslte_viterbi_t *q,
srslte_viterbi_type_t type, srslte_viterbi_type_t type,
uint32_t poly[3], int poly[3],
uint32_t max_frame_length, uint32_t max_frame_length,
bool tail_bitting); bool tail_bitting);
@ -88,7 +87,7 @@ SRSLTE_API int srslte_viterbi_decode_uc(srslte_viterbi_t *q,
SRSLTE_API int srslte_viterbi_init_sse(srslte_viterbi_t *q, SRSLTE_API int srslte_viterbi_init_sse(srslte_viterbi_t *q,
srslte_viterbi_type_t type, srslte_viterbi_type_t type,
uint32_t poly[3], int poly[3],
uint32_t max_frame_length, uint32_t max_frame_length,
bool tail_bitting); bool tail_bitting);

@ -60,7 +60,7 @@ void mexFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prhs[])
output_data = srslte_vec_malloc(nof_bits * sizeof(uint8_t)); output_data = srslte_vec_malloc(nof_bits * sizeof(uint8_t));
uint32_t poly[3] = { 0x6D, 0x4F, 0x57 }; int poly[3] = { 0x6D, 0x4F, 0x57 };
if (srslte_viterbi_init(&viterbi, SRSLTE_VITERBI_37, poly, nof_bits/3, true)) { if (srslte_viterbi_init(&viterbi, SRSLTE_VITERBI_37, poly, nof_bits/3, true)) {
return; return;
} }

@ -130,7 +130,7 @@ void free37(void *o) {
delete_viterbi37_port(q->ptr); delete_viterbi37_port(q->ptr);
} }
int init37(srslte_viterbi_t *q, uint32_t poly[3], uint32_t framebits, bool tail_biting) { int init37(srslte_viterbi_t *q, int poly[3], uint32_t framebits, bool tail_biting) {
q->K = 7; q->K = 7;
q->R = 3; q->R = 3;
q->framebits = framebits; q->framebits = framebits;
@ -166,7 +166,7 @@ int init37(srslte_viterbi_t *q, uint32_t poly[3], uint32_t framebits, bool tail_
} }
#ifdef LV_HAVE_SSE #ifdef LV_HAVE_SSE
int init37_sse(srslte_viterbi_t *q, uint32_t poly[3], uint32_t framebits, bool tail_biting) { int init37_sse(srslte_viterbi_t *q, int poly[3], uint32_t framebits, bool tail_biting) {
q->K = 7; q->K = 7;
q->R = 3; q->R = 3;
q->framebits = framebits; q->framebits = framebits;
@ -205,7 +205,7 @@ void srslte_viterbi_set_gain_quant(srslte_viterbi_t *q, float gain_quant) {
q->gain_quant = gain_quant; q->gain_quant = gain_quant;
} }
int srslte_viterbi_init(srslte_viterbi_t *q, srslte_viterbi_type_t type, uint32_t poly[3], uint32_t max_frame_length, bool tail_bitting) int srslte_viterbi_init(srslte_viterbi_t *q, srslte_viterbi_type_t type, int poly[3], uint32_t max_frame_length, bool tail_bitting)
{ {
switch (type) { switch (type) {
case SRSLTE_VITERBI_37: case SRSLTE_VITERBI_37:
@ -221,7 +221,7 @@ int srslte_viterbi_init(srslte_viterbi_t *q, srslte_viterbi_type_t type, uint32_
} }
#ifdef LV_HAVE_SSE #ifdef LV_HAVE_SSE
int srslte_viterbi_init_sse(srslte_viterbi_t *q, srslte_viterbi_type_t type, uint32_t poly[3], uint32_t max_frame_length, bool tail_bitting) int srslte_viterbi_init_sse(srslte_viterbi_t *q, srslte_viterbi_type_t type, int poly[3], uint32_t max_frame_length, bool tail_bitting)
{ {
return init37_sse(q, poly, max_frame_length, tail_bitting); return init37_sse(q, poly, max_frame_length, tail_bitting);
} }

@ -26,7 +26,7 @@
#include <stdbool.h> #include <stdbool.h>
void *create_viterbi37_port(uint32_t polys[3], void *create_viterbi37_port(int polys[3],
uint32_t len); uint32_t len);
int init_viterbi37_port(void *p, int init_viterbi37_port(void *p,
@ -45,7 +45,7 @@ int update_viterbi37_blk_port(void *p,
uint32_t *best_state); uint32_t *best_state);
void *create_viterbi37_sse(uint32_t polys[3], void *create_viterbi37_sse(int polys[3],
uint32_t len); uint32_t len);
int init_viterbi37_sse(void *p, int init_viterbi37_sse(void *p,

@ -54,8 +54,8 @@ int init_viterbi37_port(void *p, int starting_state) {
return 0; return 0;
} }
void set_viterbi37_polynomial_port(uint32_t polys[3]) { void set_viterbi37_polynomial_port(int polys[3]) {
uint32_t state; int state;
for (state = 0; state < 32; state++) { for (state = 0; state < 32; state++) {
Branchtab37[0].c[state] = Branchtab37[0].c[state] =
@ -68,7 +68,7 @@ void set_viterbi37_polynomial_port(uint32_t polys[3]) {
} }
/* Create a new instance of a Viterbi decoder */ /* Create a new instance of a Viterbi decoder */
void *create_viterbi37_port(uint32_t polys[3], uint32_t len) { void *create_viterbi37_port(int polys[3], uint32_t len) {
struct v37 *vp; struct v37 *vp;
set_viterbi37_polynomial_port(polys); set_viterbi37_polynomial_port(polys);

@ -44,7 +44,7 @@ struct v37 {
decision_t *decisions; /* Beginning of decisions for block */ decision_t *decisions; /* Beginning of decisions for block */
}; };
void set_viterbi37_polynomial_sse(uint32_t polys[3]) { void set_viterbi37_polynomial_sse(int polys[3]) {
int state; int state;
for(state=0;state < 32;state++){ for(state=0;state < 32;state++){
@ -73,7 +73,7 @@ int init_viterbi37_sse(void *p, int starting_state) {
} }
/* Create a new instance of a Viterbi decoder */ /* Create a new instance of a Viterbi decoder */
void *create_viterbi37_sse(uint32_t polys[3], uint32_t len) { void *create_viterbi37_sse(int polys[3], uint32_t len) {
void *p; void *p;
struct v37 *vp; struct v37 *vp;

@ -71,7 +71,7 @@ int srslte_cqi_format2_subband_pack(srslte_cqi_format2_subband_t *msg, uint8_t b
uint8_t *body_ptr = buff; uint8_t *body_ptr = buff;
srslte_bit_unpack(msg->subband_cqi, &body_ptr, 4); srslte_bit_unpack(msg->subband_cqi, &body_ptr, 4);
srslte_bit_unpack(msg->subband_label, &body_ptr, msg->subband_label_2_bits?2:1); srslte_bit_unpack(msg->subband_label, &body_ptr, msg->subband_label_2_bits?2:1);
return 4+msg->subband_label_2_bits?2:1; return 4+(msg->subband_label_2_bits)?2:1;
} }
int srslte_cqi_value_pack(srslte_cqi_value_t *value, uint8_t buff[SRSLTE_CQI_MAX_BITS]) int srslte_cqi_value_pack(srslte_cqi_value_t *value, uint8_t buff[SRSLTE_CQI_MAX_BITS])

@ -158,7 +158,7 @@ int srslte_pbch_init(srslte_pbch_t *q, srslte_cell_t cell) {
goto clean; goto clean;
} }
uint32_t poly[3] = { 0x6D, 0x4F, 0x57 }; int poly[3] = { 0x6D, 0x4F, 0x57 };
if (srslte_viterbi_init(&q->decoder, SRSLTE_VITERBI_37, poly, 40, true)) { if (srslte_viterbi_init(&q->decoder, SRSLTE_VITERBI_37, poly, 40, true)) {
goto clean; goto clean;
} }

@ -88,7 +88,7 @@ int srslte_pdcch_init(srslte_pdcch_t *q, srslte_regs_t *regs, srslte_cell_t cell
} }
} }
uint32_t poly[3] = { 0x6D, 0x4F, 0x57 }; int poly[3] = { 0x6D, 0x4F, 0x57 };
if (srslte_viterbi_init(&q->decoder, SRSLTE_VITERBI_37, poly, SRSLTE_DCI_MAX_BITS + 16, true)) { if (srslte_viterbi_init(&q->decoder, SRSLTE_VITERBI_37, poly, SRSLTE_DCI_MAX_BITS + 16, true)) {
goto clean; goto clean;
} }

@ -232,7 +232,7 @@ int srslte_prach_gen_seqs(srslte_prach_t *p)
uint32_t d_u = 0; uint32_t d_u = 0;
uint32_t d_start = 0; uint32_t d_start = 0;
uint32_t N_shift = 0; uint32_t N_shift = 0;
uint32_t N_neg_shift = 0; int N_neg_shift = 0;
uint32_t N_group = 0; uint32_t N_group = 0;
uint32_t C_v = 0; uint32_t C_v = 0;
cf_t root[839]; cf_t root[839];

Loading…
Cancel
Save