File: ldpc32_table.c

package info (click to toggle)
wsjtx 2.0.0%2Brepack-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 192,624 kB
  • sloc: cpp: 1,071,838; ansic: 60,751; f90: 25,266; python: 20,318; sh: 10,636; xml: 8,148; cs: 2,121; fortran: 2,051; yacc: 472; asm: 353; makefile: 316; perl: 19
file content (30 lines) | stat: -rw-r--r-- 796 bytes parent folder | download | duplicates (11)
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
void ldpc32_table_(int cw[])
{
  // Compute and return the table of 65535 codewords for the (32,16) code.

  // Array y contains the sixteen rows (columns) of the parity-check matrix
  int y[16] = { 0xd452, 0x7ecb, 0xc5d5, 0xf81c, 
                0x61d7, 0x0ed8, 0xa3c5, 0x9ef9,
                0xb3bd, 0xe5b6, 0x2fcd, 0xc23a,
                0x5deb, 0xfa0e, 0x35fc, 0x1379 };

  unsigned int c[2];          /* Codeword composed of 16-bit info and 16-bit parity */


  int i,j,k;
  int aux;
  int weight(int vector); 

  for(k=0; k<65536; k++) {
    c[0] = k;
    c[1] = 0;
    for (i=0; i<16; i++) {
      aux = 0;
      for (j=0; j<16; j++) {
	aux = aux ^ ((c[0] & y[i]) >> j & 1);
      }
      c[1] = (c[1] << 1) ^ aux;
    }
    cw[k]=65536*c[1] + c[0];
  }
}