diff options
| author | Christoph Berg <myon@debian.org> | 2026-04-07 19:02:45 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-04-07 19:02:45 +0200 |
| commit | f647d78463c1250ce9c99af664615fafccf5e959 (patch) | |
| tree | 5b00428cef68aef1c9d407e2d4535687422419b6 /lib/golay24_table.c | |
| parent | 0a13f1fdb9928b6d012569dd65f7f6ef18fac2f8 (diff) | |
New upstream version 3.0.0upstream/3.0.0
Diffstat (limited to 'lib/golay24_table.c')
| -rw-r--r--[-rwxr-xr-x] | lib/golay24_table.c | 56 |
1 files changed, 28 insertions, 28 deletions
diff --git a/lib/golay24_table.c b/lib/golay24_table.c index f7bd8750..a015c759 100755..100644 --- a/lib/golay24_table.c +++ b/lib/golay24_table.c @@ -1,28 +1,28 @@ -void golay24_table_(int cw[])
-{
- // Compute arnd return the table of 4096 codewords for the Golay (24,12) code.
-
- // Array y contains the twelve rows (columns) of the parity-check matrix
- int y[12] = { 0x7ff, 0xee2, 0xdc5, 0xb8b, 0xf16, 0xe2d,
- 0xc5b, 0x8b7, 0x96e, 0xadc, 0xdb8, 0xb71 };
-
- int c[2]; /* Codeword composed of 12-bit info and 12-bit parity */
-
-
- int i,j,k;
- int aux;
- int weight(int vector);
-
- for(k=0; k<4096; k++) {
- c[0] = k;
- c[1] = 0;
- for (i=0; i<12; i++) {
- aux = 0;
- for (j=0; j<12; j++) {
- aux = aux ^ ((c[0] & y[i]) >> j & 1);
- }
- c[1] = (c[1] << 1) ^ aux;
- }
- cw[k]=4096*c[0] + c[1];
- }
-}
+void golay24_table_(int cw[]) +{ + // Compute arnd return the table of 4096 codewords for the Golay (24,12) code. + + // Array y contains the twelve rows (columns) of the parity-check matrix + int y[12] = { 0x7ff, 0xee2, 0xdc5, 0xb8b, 0xf16, 0xe2d, + 0xc5b, 0x8b7, 0x96e, 0xadc, 0xdb8, 0xb71 }; + + int c[2]; /* Codeword composed of 12-bit info and 12-bit parity */ + + + int i,j,k; + int aux; + int weight(int vector); + + for(k=0; k<4096; k++) { + c[0] = k; + c[1] = 0; + for (i=0; i<12; i++) { + aux = 0; + for (j=0; j<12; j++) { + aux = aux ^ ((c[0] & y[i]) >> j & 1); + } + c[1] = (c[1] << 1) ^ aux; + } + cw[k]=4096*c[0] + c[1]; + } +} |
