added data_len argument for shortened codes

This commit is contained in:
Ahmet Inan 2018-09-27 18:29:13 +02:00
commit 62819a5376
4 changed files with 60 additions and 39 deletions

View file

@ -48,12 +48,13 @@ public:
for (int i = 0; i <= NR; ++i)
generator[i] = index(tmp[i]);
}
void operator()(ValueType *data, ValueType *parity)
void operator()(ValueType *data, ValueType *parity, int data_len = K)
{
assert(0 < data_len && data_len <= K);
// $code = data * x^{NR} + (data * x^{NR}) \mod{generator}$
for (int i = 0; i < NR; ++i)
parity[i] = ValueType(0);
for (int i = 0; i < K; ++i) {
for (int i = 0; i < data_len; ++i) {
ValueType feedback = data[i] + parity[0];
if (feedback) {
IndexType fb = index(feedback);
@ -67,9 +68,9 @@ public:
}
}
}
void operator()(value_type *data, value_type *parity)
void operator()(value_type *data, value_type *parity, int data_len = K)
{
(*this)(reinterpret_cast<ValueType *>(data), reinterpret_cast<ValueType *>(parity));
(*this)(reinterpret_cast<ValueType *>(data), reinterpret_cast<ValueType *>(parity), data_len);
}
};