diff --git a/lib/qra/qra65/main.c b/lib/qra/qra65/main.c index 2cdc19a8e..af68c791b 100644 --- a/lib/qra/qra65/main.c +++ b/lib/qra/qra65/main.c @@ -74,6 +74,7 @@ unsigned GetTickCount(void) { #include #include +#include #include "qra65.h" #include "../qracodes/normrnd.h" // gaussian numbers generator @@ -209,7 +210,7 @@ int test_proc_1(int channel_type, float EbNodB, int mode) int x[QRA65_K], xdec[QRA65_K]; int y[QRA65_N]; - float *r; + float *rx; int rc; // each simulated station must use its own codec @@ -222,40 +223,40 @@ int test_proc_1(int channel_type, float EbNodB, int mode) printf("IV3NWV tx: CQ IV3NWV\n"); encodemsg_jt65(x,CALL_CQ,CALL_IV3NWV,GRID_BLANK); qra65_encode(codec_iv3nwv, y, x); - r = mfskchannel(y,channel_type,EbNodB); + rx = mfskchannel(y,channel_type,EbNodB); // K1JT attempts to decode - rc = qra65_decode(codec_k1jt, xdec,r); + rc = qra65_decode(codec_k1jt, xdec,rx); if (rc>=0) { // decoded printf("K1JT rx: received with apcode=%d %s\n",rc, decode_type[rc]); // K1JT replies to IV3NWV (with no grid) printf("K1JT tx: IV3NWV K1JT\n"); encodemsg_jt65(x,CALL_IV3NWV,CALL_K1JT, GRID_BLANK); qra65_encode(codec_k1jt, y, x); - r = mfskchannel(y,channel_type,EbNodB); + rx = mfskchannel(y,channel_type,EbNodB); // IV3NWV attempts to decode - rc = qra65_decode(codec_iv3nwv, xdec,r); + rc = qra65_decode(codec_iv3nwv, xdec,rx); if (rc>=0) { // decoded printf("IV3NWV rx: received with apcode=%d %s\n",rc, decode_type[rc]); // IV3NWV replies to K1JT with a 73 printf("IV3NWV tx: K1JT IV3NWV 73\n"); encodemsg_jt65(x,CALL_K1JT,CALL_IV3NWV, GRID_73); qra65_encode(codec_iv3nwv, y, x); - r = mfskchannel(y,channel_type,EbNodB); + rx = mfskchannel(y,channel_type,EbNodB); // K1JT attempts to decode - rc = qra65_decode(codec_k1jt, xdec,r); + rc = qra65_decode(codec_k1jt, xdec,rx); if (rc>=0) { // decoded printf("K1JT rx: received with apcode=%d %s\n",rc, decode_type[rc]); // K1JT replies to IV3NWV with a 73 printf("K1JT tx: IV3NWV K1JT 73\n"); encodemsg_jt65(x,CALL_IV3NWV,CALL_K1JT, GRID_73); qra65_encode(codec_k1jt, y, x); - r = mfskchannel(y,channel_type,EbNodB); + rx = mfskchannel(y,channel_type,EbNodB); // IV3NWV attempts to decode - rc = qra65_decode(codec_iv3nwv, xdec,r); + rc = qra65_decode(codec_iv3nwv, xdec,rx); if (rc>=0) { // decoded printf("IV3NWV rx: received with apcode=%d %s\n",rc, decode_type[rc]); return 0; @@ -292,7 +293,7 @@ int test_proc_2(int channel_type, float EbNodB, int mode) int x[QRA65_K], xdec[QRA65_K]; int y[QRA65_N]; - float *r; + float *rx; int rc,k; int ndecok[6] = { 0, 0, 0, 0, 0, 0}; @@ -315,8 +316,8 @@ int test_proc_2(int channel_type, float EbNodB, int mode) for (k=0;k=0) ndecok[rc]++; } @@ -369,7 +370,7 @@ int main(int argc, char* argv[]) } else if (strncmp(*argv,"-a",2)==0) { - mode = (unsigned int)atoi((*argv)+2); + mode = ( int)atoi((*argv)+2); if (mode>1) { printf("Invalid decoding mode\n"); syntax(); @@ -387,7 +388,7 @@ int main(int argc, char* argv[]) } else if (strncmp(*argv,"-t",2)==0) { - testtype = (unsigned int)atoi((*argv)+2); + testtype = ( int)atoi((*argv)+2); if (testtype>1) { printf("Invalid test type\n"); syntax(); @@ -396,7 +397,7 @@ int main(int argc, char* argv[]) } else if (strncmp(*argv,"-c",2)==0) { - channel = (unsigned int)atoi((*argv)+2); + channel = ( int)atoi((*argv)+2); if (channel>CHANNEL_RAYLEIGH) { printf("Invalid channel type\n"); syntax(); @@ -412,6 +413,10 @@ int main(int argc, char* argv[]) EbNodB = SNRdB+29.1f; +#if defined(__linux__) || defined(__unix__) + srand48(GetTickCount()); +#endif + if (testtype==0) { for (k=0;k #include -unsigned GetTickCount(void) { + GetTickCount(void) { struct timespec ts; - unsigned theTick = 0U; + theTick = 0U; clock_gettime( CLOCK_REALTIME, &ts ); theTick = ts.tv_nsec / 1000000; theTick += ts.tv_sec * 1000; @@ -116,7 +116,7 @@ const char fnameout_sfx[4][64] = { "-ap56.txt" }; -const uint ap_masks_jt65[4][13] = { +const int ap_masks_jt65[4][13] = { // Each row must be 13 entries long (to handle puntc. codes 13,64) // The mask of 13th symbol (crc) is alway initializated to 0 // AP0 - no a-priori knowledge @@ -150,8 +150,8 @@ typedef struct { volatile int done; int ap_index; // index to the a priori knowledge mask const qracode *pcode; // pointer to the code descriptor - uint *x; //[qra_K]; input message buffer - uint *y, *ydec; //[qra_N]; encoded/decoded codewords buffers + int *x; //[qra_K]; input message buffer + int *y, *ydec; //[qra_N]; encoded/decoded codewords buffers float *qra_v2cmsg; //[qra_NMSG*qra_M]; MP decoder v->c msg buffer float *qra_c2vmsg; //[qra_NMSG*qra_M]; MP decoder c->v msg buffer float *rp; // [qra_N*qra_M]; received samples (real component) buffer @@ -194,11 +194,11 @@ int calc_crc6(int *x, int sz) void wer_test_thread(wer_test_ds *pdata) { const qracode *pcode=pdata->pcode; - const uint qra_K = pcode->K; - const uint qra_N = pcode->N; - const uint qra_M = pcode->M; - const uint qra_m = pcode->m; - const uint NSAMPLES = pcode->N*pcode->M; + const int qra_K = pcode->K; + const int qra_N = pcode->N; + const int qra_M = pcode->M; + const int qra_m = pcode->m; + const int NSAMPLES = pcode->N*pcode->M; const float No = 1.0f; // noise spectral density const float sigma = (float)sqrt(No/2.0f); // std dev of noise I/Q components @@ -208,7 +208,7 @@ void wer_test_thread(wer_test_ds *pdata) const float EbNodBMetric = 2.8f; const float EbNoMetric = (float)pow(10,EbNodBMetric/10); - uint k,t,j,diff; + int k,t,j,diff; float R; float EsNoMetric; float EbNo, EsNo, Es, A; @@ -220,8 +220,8 @@ void wer_test_thread(wer_test_ds *pdata) // inizialize pointer to required buffers - uint *x=pdata->x; // message buffer - uint *y=pdata->y, *ydec=pdata->ydec; // encoded/decoded codeword buffers + int *x=pdata->x; // message buffer + int *y=pdata->y, *ydec=pdata->ydec; // encoded/decoded codeword buffers float *qra_v2cmsg=pdata->qra_v2cmsg; // table of the v->c messages float *qra_c2vmsg=pdata->qra_c2vmsg; // table of the c->v messages float *rp=pdata->rp; // received samples (real component) @@ -374,10 +374,10 @@ void ix_mask(const qracode *pcode, float *r, const int *mask, const int *x) { // mask intrinsic information (channel observations) with a priori knowledge - uint k,kk, smask; - const uint qra_K=pcode->K; - const uint qra_M=pcode->M; - const uint qra_m=pcode->m; + int k,kk, smask; + const int qra_K=pcode->K; + const int qra_M=pcode->M; + const int qra_m=pcode->m; for (k=0;kK*sizeof(uint)); - wt[j].y = (uint*)malloc(pcode->N*sizeof(uint)); - wt[j].ydec = (uint*)malloc(pcode->N*sizeof(uint)); + wt[j].x = (int*)malloc(pcode->K*sizeof(int)); + wt[j].y = (int*)malloc(pcode->N*sizeof(int)); + wt[j].ydec = (int*)malloc(pcode->N*sizeof(int)); wt[j].qra_v2cmsg = (float*)malloc(pcode->NMSG*pcode->M*sizeof(float)); wt[j].qra_c2vmsg = (float*)malloc(pcode->NMSG*pcode->M*sizeof(float)); wt[j].rp = (float*)malloc(pcode->N*pcode->M*sizeof(float)); @@ -570,17 +570,17 @@ int main(int argc, char* argv[]) { float EbNodB[SIM_POINTS_MAX]; - uint nerrstgt[SIM_POINTS_MAX]; + int nerrstgt[SIM_POINTS_MAX]; FILE *fin; char fnamein[128]= "ebnovalues.txt"; char buf[128]; - uint nitems = 0; - uint code_idx = 1; - uint nthreads = 8; - uint ch_type = CHANNEL_AWGN; - uint ap_index = AP_NONE; + int nitems = 0; + int code_idx = 1; + int nthreads = 8; + int ch_type = CHANNEL_AWGN; + int ap_index = AP_NONE; // parse command line while(--argc) { @@ -591,7 +591,7 @@ int main(int argc, char* argv[]) } else if (strncmp(*argv,"-q",2)==0) { - code_idx = (uint)atoi((*argv)+2); + code_idx = (int)atoi((*argv)+2); if (code_idx>1) { printf("Invalid code index\n"); syntax(); @@ -600,7 +600,7 @@ int main(int argc, char* argv[]) } else if (strncmp(*argv,"-t",2)==0) { - nthreads = (uint)atoi((*argv)+2); + nthreads = (int)atoi((*argv)+2); if (nthreads>NTHREADS_MAX) { printf("Invalid number of threads\n"); syntax(); @@ -609,7 +609,7 @@ int main(int argc, char* argv[]) } else if (strncmp(*argv,"-c",2)==0) { - ch_type = (uint)atoi((*argv)+2); + ch_type = (int)atoi((*argv)+2); if (ch_type>CHANNEL_RAYLEIGH) { printf("Invalid channel type\n"); syntax(); @@ -618,7 +618,7 @@ int main(int argc, char* argv[]) } else if (strncmp(*argv,"-a",2)==0) { - ap_index = (uint)atoi((*argv)+2); + ap_index = (int)atoi((*argv)+2); if (ap_index>AP_56) { printf("Invalid a-priori information index\n"); syntax(); diff --git a/lib/qra/qracodes/normrnd.c b/lib/qra/qracodes/normrnd.c index e6b62b1f2..c14e3b3c1 100644 --- a/lib/qra/qracodes/normrnd.c +++ b/lib/qra/qracodes/normrnd.c @@ -29,19 +29,22 @@ #if _WIN32 // note the underscore: without it, it's not msdn official! // Windows (x64 and x86) #include // required only for GetTickCount(...) + #define K_RAND_MAX UINT_MAX #elif __unix__ // all unices, not all compilers - #define rand_s rand_r #include - #include // for UINT_MAX + #define rand_s(x) (*x)=(unsigned int)lrand48() // returns unsigned integers in the range 0..0x7FFFFFFF + #define K_RAND_MAX 0x7FFFFFFF // that's the max number generated by lrand48 // Unix #elif __linux__ + #include + #define rand_s(x) (*x)=(unsigned int)lrand48() // returns unsigned integers in the range 0..0x7FFFFFFF + #define K_RAND_MAX 0x7FFFFFFF // that's the max number generated by lrand48 // linux #elif __APPLE__ // Mac OS, not sure if this is covered by __posix__ and/or __unix__ though... #endif - // use MS rand_s(...) function void normrnd_s(float *dst, int nitems, float mean, float stdev) { @@ -55,13 +58,14 @@ void normrnd_s(float *dst, int nitems, float mean, float stdev) set = 0; } else { - rand_s(&r); phi = (M_2PI/(1.0f+UINT_MAX))*r; - rand_s(&r); u = (float)sqrt(-2.0f* log( (1.0f/(1.0f+UINT_MAX))*(1.0f+r) ) ); + rand_s((unsigned int*)&r); phi = (M_2PI/(1.0f+K_RAND_MAX))*r; + rand_s((unsigned int*)&r); u = (float)sqrt(-2.0f* log( (1.0f/(1.0f+K_RAND_MAX))*(1.0f+r) ) ); *dst++ = (float)cos(phi)*u*stdev+mean; set=1; } } +/* NOT USED // use MS rand() function void normrnd(float *dst, int nitems, float mean, float stdev) { @@ -80,4 +84,4 @@ void normrnd(float *dst, int nitems, float mean, float stdev) set=1; } } - +*/ diff --git a/lib/qra/qracodes/normrnd.h b/lib/qra/qracodes/normrnd.h index 6f4006fab..dd4b65bbe 100644 --- a/lib/qra/qracodes/normrnd.h +++ b/lib/qra/qracodes/normrnd.h @@ -37,9 +37,11 @@ void normrnd_s(float *dst, int nitems, float mean, float stdev); // generate a random array of numbers with a gaussian distribution of given mean and stdev // use MS rand_s(...) function +/* not used void normrnd(float *dst, int nitems, float mean, float stdev); // generate a random array of numbers with a gaussian distribution of given mean and stdev // use MS rand() function +*/ #ifdef __cplusplus } diff --git a/lib/qra/qracodes/pdmath.c b/lib/qra/qracodes/pdmath.c index 2529a0901..47ecab917 100644 --- a/lib/qra/qracodes/pdmath.c +++ b/lib/qra/qracodes/pdmath.c @@ -331,14 +331,14 @@ void pd_memset(float *dst, const float *src, int ndim, int nitems) } } -void pd_fwdperm(float *dst, float *src, const unsigned int *perm, int ndim) +void pd_fwdperm(float *dst, float *src, const int *perm, int ndim) { // TODO: non-loop implementation while (ndim--) dst[ndim] = src[perm[ndim]]; } -void pd_bwdperm(float *dst, float *src, const unsigned int *perm, int ndim) +void pd_bwdperm(float *dst, float *src, const int *perm, int ndim) { // TODO: non-loop implementation while (ndim--) diff --git a/lib/qra/qracodes/pdmath.h b/lib/qra/qracodes/pdmath.h index b96c98b36..bbd1210c4 100644 --- a/lib/qra/qracodes/pdmath.h +++ b/lib/qra/qracodes/pdmath.h @@ -57,12 +57,12 @@ float pd_norm(float *pd, int nlogdim); // are replaced with a uniform distribution // Returns the norm of the distribution prior to the normalization -void pd_fwdperm(float *dst, float *src, const unsigned int *perm, int ndim); +void pd_fwdperm(float *dst, float *src, const int *perm, int ndim); // Forward permutation of a distribution // Computes dst[k] = src[perm[k]] for every element in the distribution // perm must be a pointer to an array of integers of length ndim -void pd_bwdperm(float *dst, float *src, const unsigned int *perm, int ndim); +void pd_bwdperm(float *dst, float *src, const int *perm, int ndim); // Backward permutation of a distribution // Computes dst[perm[k]] = src[k] for every element in the distribution // perm must be a pointer to an array of integers of length ndim diff --git a/lib/qra/qracodes/qra12_63_64_irr_b.c b/lib/qra/qracodes/qra12_63_64_irr_b.c index a192b41ab..d69443b89 100644 --- a/lib/qra/qracodes/qra12_63_64_irr_b.c +++ b/lib/qra/qracodes/qra12_63_64_irr_b.c @@ -52,7 +52,7 @@ static const int qra_acc_input_idx[qra_NC+1] = { }; // table of the systematic symbols weight logarithms over GF(M) -static const unsigned int qra_acc_input_wlog[qra_NC+1] = { +static const int qra_acc_input_wlog[qra_NC+1] = { 39, 0, 34, 16, 25, 0, 34, 48, 19, 13, 29, 56, 0, 5, 39, 42, 31, 0, 10, 0, 57, 62, 33, 43, 0, 14, 22, 48, 28, 20, @@ -73,7 +73,7 @@ static const int qra_log[qra_M] = { }; // table of GF(M) elements given their logarithm -static const unsigned int qra_exp[qra_M-1] = { +static const int qra_exp[qra_M-1] = { 1, 2, 4, 8, 16, 32, 3, 6, 12, 24, 48, 35, 5, 10, 20, 40, 19, 38, 15, 30, 60, 59, 53, 41, 17, 34, 7, 14, 28, 56, @@ -84,7 +84,7 @@ static const unsigned int qra_exp[qra_M-1] = { }; // table of the messages weight logarithms over GF(M) -static const unsigned int qra_msgw[qra_NMSG] = { +static const int qra_msgw[qra_NMSG] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -110,7 +110,7 @@ static const unsigned int qra_msgw[qra_NMSG] = { }; // table of the degrees of the variable nodes -static const unsigned int qra_vdeg[qra_V] = { +static const int qra_vdeg[qra_V] = { 4, 4, 4, 4, 5, 5, 5, 6, 6, 6, 7, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, @@ -121,7 +121,7 @@ static const unsigned int qra_vdeg[qra_V] = { }; // table of the degrees of the factor nodes -static const unsigned int qra_cdeg[qra_C] = { +static const int qra_cdeg[qra_C] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -237,7 +237,7 @@ static const int qra_c2vmidx[qra_C*qra_MAXCDEG] = { }; // permutation matrix to compute Prob(x*alfa^logw) -static const unsigned int qra_pmat[qra_M*qra_M] = { +static const int qra_pmat[qra_M*qra_M] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, diff --git a/lib/qra/qracodes/qra13_64_64_irr_e.c b/lib/qra/qracodes/qra13_64_64_irr_e.c index 75d6b4884..7adf22fea 100644 --- a/lib/qra/qracodes/qra13_64_64_irr_e.c +++ b/lib/qra/qracodes/qra13_64_64_irr_e.c @@ -51,7 +51,7 @@ static const int qra_acc_input_idx[qra_NC+1] = { }; // table of the systematic symbols weight logarithms over GF(M) -static const unsigned int qra_acc_input_wlog[qra_NC+1] = { +static const int qra_acc_input_wlog[qra_NC+1] = { 0, 27, 0, 0, 0, 31, 28, 61, 31, 0, 0, 52, 22, 7, 19, 47, 44, 62, 32, 50, 52, 42, 48, 56, 40, 50, 51, 37, 37, 0, @@ -72,7 +72,7 @@ static const int qra_log[qra_M] = { }; // table of GF(M) elements given their logarithm -static const unsigned int qra_exp[qra_M-1] = { +static const int qra_exp[qra_M-1] = { 1, 2, 4, 8, 16, 32, 3, 6, 12, 24, 48, 35, 5, 10, 20, 40, 19, 38, 15, 30, 60, 59, 53, 41, 17, 34, 7, 14, 28, 56, @@ -83,7 +83,7 @@ static const unsigned int qra_exp[qra_M-1] = { }; // table of the messages weight logarithms over GF(M) -static const unsigned int qra_msgw[qra_NMSG] = { +static const int qra_msgw[qra_NMSG] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, @@ -109,7 +109,7 @@ static const unsigned int qra_msgw[qra_NMSG] = { }; // table of the degrees of the variable nodes -static const unsigned int qra_vdeg[qra_V] = { +static const int qra_vdeg[qra_V] = { 4, 4, 4, 4, 5, 5, 5, 5, 7, 4, 4, 6, 8, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, @@ -120,7 +120,7 @@ static const unsigned int qra_vdeg[qra_V] = { }; // table of the degrees of the factor nodes -static const unsigned int qra_cdeg[qra_C] = { +static const int qra_cdeg[qra_C] = { 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, @@ -237,7 +237,7 @@ static const int qra_c2vmidx[qra_C*qra_MAXCDEG] = { }; // permutation matrix to compute Prob(x*alfa^logw) -static const unsigned int qra_pmat[qra_M*qra_M] = { +static const int qra_pmat[qra_M*qra_M] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, diff --git a/lib/qra/qracodes/qracodes.c b/lib/qra/qracodes/qracodes.c index 253dde0fa..7af0945bf 100644 --- a/lib/qra/qracodes/qracodes.c +++ b/lib/qra/qracodes/qracodes.c @@ -29,22 +29,22 @@ #define QRA_DEBUG -int qra_encode(const qracode *pcode, uint *y, const uint *x) +int qra_encode(const qracode *pcode, int *y, const int *x) { - uint k,j,kk,jj; - uint t, chk = 0; + int k,j,kk,jj; + int t, chk = 0; - const uint K = pcode->K; - const uint M = pcode->M; - const uint NC= pcode->NC; - const uint a = pcode->a; + const int K = pcode->K; + const int M = pcode->M; + const int NC= pcode->NC; + const int a = pcode->a; const int *acc_input_idx = pcode->acc_input_idx; - const uint *acc_input_wlog = pcode->acc_input_wlog; + const int *acc_input_wlog = pcode->acc_input_wlog; const int *gflog = pcode->gflog; - const uint *gfexp = pcode->gfexp; + const int *gfexp = pcode->gfexp; // copy the systematic symbols to destination - memcpy(y,x,K*sizeof(uint)); + memcpy(y,x,K*sizeof(int)); y = y+K; // point to check symbols @@ -144,7 +144,7 @@ static void qra_ioapprox(float *src, float C, int nitems) } -void qra_mfskbesselmetric(float *pix, const float *rsq, const uint m, const uint N, float EsNoMetric) +void qra_mfskbesselmetric(float *pix, const float *rsq, const int m, const int N, float EsNoMetric) { // Computes the codeword symbols intrinsic probabilities // given the square of the received input amplitudes. @@ -167,12 +167,12 @@ void qra_mfskbesselmetric(float *pix, const float *rsq, const uint m, const uint // nevertheless it is usually better than a generic parameter-free metric which // makes no assumptions on the input Es/No. - uint k; + int k; float rsum = 0.f; float sigmaest, cmetric; - const uint M = 1<M; - const uint qra_m = pcode->m; - const uint qra_V = pcode->V; - const uint qra_MAXVDEG = pcode->MAXVDEG; + const int qra_M = pcode->M; + const int qra_m = pcode->m; + const int qra_V = pcode->V; + const int qra_MAXVDEG = pcode->MAXVDEG; const int *qra_vdeg = pcode->vdeg; - const uint qra_C = pcode->C; - const uint qra_MAXCDEG = pcode->MAXCDEG; - const uint *qra_cdeg = pcode->cdeg; + const int qra_C = pcode->C; + const int qra_MAXCDEG = pcode->MAXCDEG; + const int *qra_cdeg = pcode->cdeg; const int *qra_v2cmidx = pcode->v2cmidx; const int *qra_c2vmidx = pcode->c2vmidx; const int *qra_pmat = pcode->gfpmat; - const uint *qra_msgw = pcode->msgw; + const int *qra_msgw = pcode->msgw; // float msgout[qra_M]; // buffer to store temporary results float msgout[QRACODE_MAX_M]; // we use a fixed size in order to avoid mallocs float totex; // total extrinsic information int nit; // current iteration - uint nv; // current variable - uint nc; // current check - uint k,kk; // loop indexes + int nv; // current variable + int nc; // current check + int k,kk; // loop indexes - uint ndeg; // current node degree + int ndeg; // current node degree int msgbase; // current offset in the table of msg indexes int imsg; // current message index int wmsg; // current message weight @@ -448,7 +448,7 @@ int qra_extrinsic(const qracode *pcode, return rc; } -void qra_mapdecode(const qracode *pcode, uint *xdec, float *pex, const float *pix) +void qra_mapdecode(const qracode *pcode, int *xdec, float *pex, const float *pix) { // Maximum a posteriori probability decoding. // Given the intrinsic information (pix) and extrinsic information (pex) (computed with qra_extrinsic(...)) @@ -460,11 +460,11 @@ void qra_mapdecode(const qracode *pcode, uint *xdec, float *pex, const float *pi // Note: pex is destroyed and overwritten with mapp - const uint qra_M = pcode->M; - const uint qra_m = pcode->m; - const uint qra_K = pcode->K; + const int qra_M = pcode->M; + const int qra_m = pcode->m; + const int qra_K = pcode->K; - uint k; + int k; for (k=0;k