mirror of
https://github.com/aicodix/code.git
synced 2026-04-27 22:35:44 +00:00
skip reduction with multiplication
This commit is contained in:
parent
455bc95a24
commit
86f1020d54
1 changed files with 9 additions and 6 deletions
|
|
@ -73,15 +73,18 @@ struct CauchyPrimeFieldErasureCoding
|
||||||
}
|
}
|
||||||
void mac(const IO *a, PF b, int len, bool first, bool last)
|
void mac(const IO *a, PF b, int len, bool first, bool last)
|
||||||
{
|
{
|
||||||
if (first) {
|
if (first && last) {
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
temp[i] = b * PF(a[i]);
|
temp[i] = b * PF(a[i]);
|
||||||
|
} else if (first) {
|
||||||
|
for (int i = 0; i < len; i++)
|
||||||
|
temp[i] = mul(b, PF(a[i]));
|
||||||
} else if (last) {
|
} else if (last) {
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
temp[i] = reduce(add(temp[i], b * PF(a[i])));
|
temp[i] = reduce(add(temp[i], mul(b, PF(a[i]))));
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
temp[i] = add(temp[i], b * PF(a[i]));
|
temp[i] = add(temp[i], mul(b, PF(a[i])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
void mac_sub(IO *c, const IO *a, PF b, IO s, int len, bool first, bool last)
|
void mac_sub(IO *c, const IO *a, PF b, IO s, int len, bool first, bool last)
|
||||||
|
|
@ -92,13 +95,13 @@ struct CauchyPrimeFieldErasureCoding
|
||||||
c[i] = (b * PF(a[i] == s ? v : a[i]))();
|
c[i] = (b * PF(a[i] == s ? v : a[i]))();
|
||||||
} else if (first) {
|
} else if (first) {
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
temp[i] = b * PF(a[i] == s ? v : a[i]);
|
temp[i] = mul(b, PF(a[i] == s ? v : a[i]));
|
||||||
} else if (last) {
|
} else if (last) {
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
c[i] = reduce(add(temp[i], b * PF(a[i] == s ? v : a[i])))();
|
c[i] = reduce(add(temp[i], mul(b, PF(a[i] == s ? v : a[i]))))();
|
||||||
} else {
|
} else {
|
||||||
for (int i = 0; i < len; i++)
|
for (int i = 0; i < len; i++)
|
||||||
temp[i] = add(temp[i], b * PF(a[i] == s ? v : a[i]));
|
temp[i] = add(temp[i], mul(b, PF(a[i] == s ? v : a[i])));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int find_unused(int block_len)
|
int find_unused(int block_len)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue