Remove stride from eval_poly_l

To match b611c51874
This commit is contained in:
Ramana Kumar 2022-10-03 20:49:45 +01:00
parent b611c51874
commit 30864e643f
No known key found for this signature in database
GPG Key ID: ED471C788B900433
1 changed files with 3 additions and 4 deletions

View File

@ -112,24 +112,23 @@ void eval_poly(fr_t *out, const poly *p, const fr_t *x) {
C_KZG_RET eval_poly_l(fr_t *out, const poly_l *p, const fr_t *x, const FFTSettings *fs) {
fr_t tmp, *inverses_in, *inverses;
uint64_t i;
const uint64_t stride = fs->max_width / p->length;
TRY(new_fr_array(&inverses_in, p->length));
TRY(new_fr_array(&inverses, p->length));
for (i = 0; i < p->length; i++) {
if (fr_equal(x, &fs->bitrevp_roots_of_unity[i * stride])) {
if (fr_equal(x, &fs->bitrevp_roots_of_unity[i])) {
*out = p->values[i];
free(inverses_in);
free(inverses);
return C_KZG_OK;
}
fr_sub(&inverses_in[i], x, &fs->bitrevp_roots_of_unity[i * stride]);
fr_sub(&inverses_in[i], x, &fs->bitrevp_roots_of_unity[i]);
}
TRY(fr_batch_inv(inverses, inverses_in, p->length));
*out = fr_zero;
for (i = 0; i < p->length; i++) {
fr_mul(&tmp, &inverses[i], &fs->bitrevp_roots_of_unity[i * stride]);
fr_mul(&tmp, &inverses[i], &fs->bitrevp_roots_of_unity[i]);
fr_mul(&tmp, &tmp, &p->values[i]);
fr_add(out, out, &tmp);
}