@@ -73,15 +73,18 @@ struct CauchyPrimeFieldErasureCoding
73
73
}
74
74
void mac (const IO *a, PF b, int len, bool first, bool last)
75
75
{
76
- if (first) {
76
+ if (first && last ) {
77
77
for (int i = 0 ; i < len; i++)
78
78
temp[i] = b * PF (a[i]);
79
+ } else if (first) {
80
+ for (int i = 0 ; i < len; i++)
81
+ temp[i] = mul (b, PF (a[i]));
79
82
} else if (last) {
80
83
for (int i = 0 ; i < len; i++)
81
- temp[i] = reduce (add (temp[i], b * PF (a[i])));
84
+ temp[i] = reduce (add (temp[i], mul (b, PF (a[i]) )));
82
85
} else {
83
86
for (int i = 0 ; i < len; i++)
84
- temp[i] = add (temp[i], b * PF (a[i]));
87
+ temp[i] = add (temp[i], mul (b, PF (a[i]) ));
85
88
}
86
89
}
87
90
void mac_sub (IO *c, const IO *a, PF b, IO s, int len, bool first, bool last)
@@ -92,13 +95,13 @@ struct CauchyPrimeFieldErasureCoding
92
95
c[i] = (b * PF (a[i] == s ? v : a[i]))();
93
96
} else if (first) {
94
97
for (int i = 0 ; i < len; i++)
95
- temp[i] = b * PF (a[i] == s ? v : a[i]);
98
+ temp[i] = mul (b, PF (a[i] == s ? v : a[i]) );
96
99
} else if (last) {
97
100
for (int i = 0 ; i < len; i++)
98
- c[i] = reduce (add (temp[i], b * PF (a[i] == s ? v : a[i])))();
101
+ c[i] = reduce (add (temp[i], mul (b, PF (a[i] == s ? v : a[i]) )))();
99
102
} else {
100
103
for (int i = 0 ; i < len; i++)
101
- temp[i] = add (temp[i], b * PF (a[i] == s ? v : a[i]));
104
+ temp[i] = add (temp[i], mul (b, PF (a[i] == s ? v : a[i]) ));
102
105
}
103
106
}
104
107
int find_unused (int block_len)
0 commit comments