mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 14:30:36 +00:00
made compiler happy
This commit is contained in:
parent
91bec0b1e3
commit
c5940d059c
7 changed files with 14 additions and 13 deletions
|
|
@ -117,7 +117,7 @@ class LDPCDecoder
|
||||||
int cnt = cnc[i];
|
int cnt = cnc[i];
|
||||||
int deg = cnt + 2;
|
int deg = cnt + 2;
|
||||||
for (int j = 0; j < W; ++j) {
|
for (int j = 0; j < W; ++j) {
|
||||||
TYPE mags[deg], inps[deg];
|
TYPE mags[CNC+2], inps[CNC+2];
|
||||||
TYPE min0 = vdup<TYPE>(127);
|
TYPE min0 = vdup<TYPE>(127);
|
||||||
TYPE min1 = vdup<TYPE>(127);
|
TYPE min1 = vdup<TYPE>(127);
|
||||||
TYPE signs = vdup<TYPE>(127);
|
TYPE signs = vdup<TYPE>(127);
|
||||||
|
|
@ -236,7 +236,7 @@ public:
|
||||||
Loc *lo = loc;
|
Loc *lo = loc;
|
||||||
for (int i = 0; i < q; ++i) {
|
for (int i = 0; i < q; ++i) {
|
||||||
int cnt = cnc[i];
|
int cnt = cnc[i];
|
||||||
int offset[cnt], shift[cnt];
|
int offset[CNC], shift[CNC];
|
||||||
for (int c = 0; c < cnt; ++c) {
|
for (int c = 0; c < cnt; ++c) {
|
||||||
shift[c] = pos[CNC*i+c] % M;
|
shift[c] = pos[CNC*i+c] % M;
|
||||||
offset[c] = pos[CNC*i+c] - shift[c];
|
offset[c] = pos[CNC*i+c] - shift[c];
|
||||||
|
|
|
||||||
|
|
@ -41,7 +41,7 @@ public:
|
||||||
}
|
}
|
||||||
for (int i = 0; i < q; ++i) {
|
for (int i = 0; i < q; ++i) {
|
||||||
int cnt = cnc[i];
|
int cnt = cnc[i];
|
||||||
int offset[cnt], shift[cnt];
|
int offset[CNC], shift[CNC];
|
||||||
for (int c = 0; c < cnt; ++c) {
|
for (int c = 0; c < cnt; ++c) {
|
||||||
shift[c] = pos[CNC*i+c] % M;
|
shift[c] = pos[CNC*i+c] % M;
|
||||||
offset[c] = pos[CNC*i+c] - shift[c];
|
offset[c] = pos[CNC*i+c] - shift[c];
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ struct PACListLeaf
|
||||||
{
|
{
|
||||||
TYPE sft = soft[1];
|
TYPE sft = soft[1];
|
||||||
for (int k = 0; k < TYPE::SIZE; ++k)
|
for (int k = 0; k < TYPE::SIZE; ++k)
|
||||||
if (conv(state+k, 0) != sft.v[k] < 0)
|
if (conv(state+k, 0) != (sft.v[k] < 0))
|
||||||
metric[k] += std::abs(sft.v[k]);
|
metric[k] += std::abs(sft.v[k]);
|
||||||
TYPE hrd;
|
TYPE hrd;
|
||||||
for (int k = 0; k < TYPE::SIZE; ++k)
|
for (int k = 0; k < TYPE::SIZE; ++k)
|
||||||
|
|
@ -53,7 +53,7 @@ struct PACListLeaf
|
||||||
for (int k = 0; k < TYPE::SIZE; ++k)
|
for (int k = 0; k < TYPE::SIZE; ++k)
|
||||||
sfork[2*k] = sfork[2*k+1] = state[k];
|
sfork[2*k] = sfork[2*k+1] = state[k];
|
||||||
for (int k = 0; k < 2*TYPE::SIZE; ++k)
|
for (int k = 0; k < 2*TYPE::SIZE; ++k)
|
||||||
if (conv(sfork+k, k&1) != sft.v[k>>1] < 0)
|
if (conv(sfork+k, k&1) != (sft.v[k>>1] < 0))
|
||||||
mfork[k] += std::abs(sft.v[k>>1]);
|
mfork[k] += std::abs(sft.v[k>>1]);
|
||||||
int perm[2*TYPE::SIZE];
|
int perm[2*TYPE::SIZE];
|
||||||
CODE::insertion_sort(perm, mfork, 2*TYPE::SIZE);
|
CODE::insertion_sort(perm, mfork, 2*TYPE::SIZE);
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ struct Chien
|
||||||
typedef typename GF::IndexType IndexType;
|
typedef typename GF::IndexType IndexType;
|
||||||
static int search(const ValueType *locator, int locator_degree, IndexType *locations)
|
static int search(const ValueType *locator, int locator_degree, IndexType *locations)
|
||||||
{
|
{
|
||||||
ValueType tmp[locator_degree+1];
|
ValueType tmp[NR+1];
|
||||||
for (int i = 0; i <= locator_degree; ++i)
|
for (int i = 0; i <= locator_degree; ++i)
|
||||||
tmp[i] = locator[i];
|
tmp[i] = locator[i];
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
|
||||||
|
|
@ -25,10 +25,10 @@ void bch_test(ENC *encode, DEC *decode, int trials)
|
||||||
int data_len = rnd_len();
|
int data_len = rnd_len();
|
||||||
auto rnd_pos = std::bind(distribution(0, data_len + ENC::NP - 1), generator);
|
auto rnd_pos = std::bind(distribution(0, data_len + ENC::NP - 1), generator);
|
||||||
int D = (data_len + 7) / 8;
|
int D = (data_len + 7) / 8;
|
||||||
uint8_t data[D], orig_data[D];
|
uint8_t data[ENC::K], orig_data[ENC::K];
|
||||||
for (int i = 0; i < D; ++i)
|
for (int i = 0; i < D; ++i)
|
||||||
data[i] = orig_data[i] = rnd_val();
|
data[i] = orig_data[i] = rnd_val();
|
||||||
int P = (ENC::NP + 7) / 8;
|
const int P = (ENC::NP + 7) / 8;
|
||||||
uint8_t parity[P];
|
uint8_t parity[P];
|
||||||
(*encode)(data, parity, data_len);
|
(*encode)(data, parity, data_len);
|
||||||
for (int i = 0; i < D; ++i)
|
for (int i = 0; i < D; ++i)
|
||||||
|
|
@ -53,7 +53,7 @@ void bch_test(ENC *encode, DEC *decode, int trials)
|
||||||
CODE::xor_be_bit(parity, pos-data_len, 1);
|
CODE::xor_be_bit(parity, pos-data_len, 1);
|
||||||
}
|
}
|
||||||
int erasures_count = DEC::NR - 2 * error_count;
|
int erasures_count = DEC::NR - 2 * error_count;
|
||||||
typename DEC::value_type erasures[erasures_count];
|
typename DEC::value_type erasures[DEC::NR];
|
||||||
for (int i = 0; i < erasures_count; ++i) {
|
for (int i = 0; i < erasures_count; ++i) {
|
||||||
int pos = rnd_pos();
|
int pos = rnd_pos();
|
||||||
for (int j = 0; j < error_count + i; ++j) {
|
for (int j = 0; j < error_count + i; ++j) {
|
||||||
|
|
@ -90,7 +90,7 @@ void bch_reference_test(ENC *encode, DEC *decode, int trials)
|
||||||
while (--trials) {
|
while (--trials) {
|
||||||
int data_len = rnd_len();
|
int data_len = rnd_len();
|
||||||
auto rnd_pos = std::bind(distribution(0, data_len + ENC::NP - 1), generator);
|
auto rnd_pos = std::bind(distribution(0, data_len + ENC::NP - 1), generator);
|
||||||
typename ENC::value_type data[data_len], orig_data[data_len];
|
typename ENC::value_type data[ENC::K], orig_data[ENC::K];
|
||||||
for (int i = 0; i < data_len; ++i)
|
for (int i = 0; i < data_len; ++i)
|
||||||
data[i] = orig_data[i] = rnd_val();
|
data[i] = orig_data[i] = rnd_val();
|
||||||
typename ENC::value_type parity[ENC::NP];
|
typename ENC::value_type parity[ENC::NP];
|
||||||
|
|
@ -117,7 +117,7 @@ void bch_reference_test(ENC *encode, DEC *decode, int trials)
|
||||||
parity[pos-data_len] ^= 1;
|
parity[pos-data_len] ^= 1;
|
||||||
}
|
}
|
||||||
int erasures_count = ENC::NR - 2 * error_count;
|
int erasures_count = ENC::NR - 2 * error_count;
|
||||||
typename ENC::value_type erasures[erasures_count];
|
typename ENC::value_type erasures[ENC::NR];
|
||||||
for (int i = 0; i < erasures_count; ++i) {
|
for (int i = 0; i < erasures_count; ++i) {
|
||||||
int pos = rnd_pos();
|
int pos = rnd_pos();
|
||||||
for (int j = 0; j < error_count + i; ++j) {
|
for (int j = 0; j < error_count + i; ++j) {
|
||||||
|
|
|
||||||
|
|
@ -24,7 +24,7 @@ void rs_test(ENC *encode, DEC *decode, int trials)
|
||||||
while (--trials) {
|
while (--trials) {
|
||||||
int data_len = rnd_len();
|
int data_len = rnd_len();
|
||||||
auto rnd_pos = std::bind(distribution(0, data_len + ENC::NP - 1), generator);
|
auto rnd_pos = std::bind(distribution(0, data_len + ENC::NP - 1), generator);
|
||||||
typename ENC::value_type data[data_len], orig_data[data_len];
|
typename ENC::value_type data[ENC::K], orig_data[ENC::K];
|
||||||
for (int i = 0; i < data_len; ++i)
|
for (int i = 0; i < data_len; ++i)
|
||||||
data[i] = orig_data[i] = rnd_val();
|
data[i] = orig_data[i] = rnd_val();
|
||||||
typename ENC::value_type parity[ENC::NP];
|
typename ENC::value_type parity[ENC::NP];
|
||||||
|
|
@ -51,7 +51,7 @@ void rs_test(ENC *encode, DEC *decode, int trials)
|
||||||
parity[pos-data_len] = rnd_val();
|
parity[pos-data_len] = rnd_val();
|
||||||
}
|
}
|
||||||
int erasures_count = ENC::NR - 2 * error_count;
|
int erasures_count = ENC::NR - 2 * error_count;
|
||||||
typename ENC::value_type erasures[erasures_count];
|
typename ENC::value_type erasures[ENC::NR];
|
||||||
for (int i = 0; i < erasures_count; ++i) {
|
for (int i = 0; i < erasures_count; ++i) {
|
||||||
int pos = rnd_pos();
|
int pos = rnd_pos();
|
||||||
for (int j = 0; j < error_count + i; ++j) {
|
for (int j = 0; j < error_count + i; ++j) {
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,7 @@ Test for xorshift
|
||||||
Copyright 2025 Ahmet Inan <inan@aicodix.de>
|
Copyright 2025 Ahmet Inan <inan@aicodix.de>
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
#include <cassert>
|
#include <cassert>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include "xorshift.hh"
|
#include "xorshift.hh"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue