diff options
| author | hibby <d@vehibberd.com> | 2018-02-16 15:18:44 +0000 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2018-02-16 15:18:44 +0000 |
| commit | 368f5331a7641772aa7e0cd1feea57d09a394a36 (patch) | |
| tree | b421ac60cc6eb726896ea268ea24e47fc4ce7c88 /lib/ldpc32_table.c | |
| parent | 71c717edc92fa771c857b3c2e5ed65f523f68f90 (diff) | |
| parent | 37f727ac0746fd85504aa46c1f023c09b3eff33a (diff) | |
Update upstream source from tag 'upstream/1.8.0+repack'
Update to upstream version '1.8.0+repack'
with Debian dir a83ef78cb70a32d1211871fdc08f3ffa295e45a8
Diffstat (limited to 'lib/ldpc32_table.c')
| -rw-r--r-- | lib/ldpc32_table.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/ldpc32_table.c b/lib/ldpc32_table.c new file mode 100644 index 00000000..3a4beaf4 --- /dev/null +++ b/lib/ldpc32_table.c @@ -0,0 +1,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];
+ }
+}
|
