bulletproofs+: some minor cleanup from vtnerd's review

This commit is contained in:
moneromooo-monero 2021-11-05 10:22:38 +00:00
parent 4c94cfecfc
commit 5acdd0e2cb
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3

View File

@ -265,7 +265,7 @@ namespace rct
rct::key res = ONE; rct::key res = ONE;
if (n == 1) if (n == 1)
return res; return x;
n += 1; n += 1;
rct::key x1 = copy(x); rct::key x1 = copy(x);
@ -317,16 +317,7 @@ namespace rct
static rct::key weighted_inner_product(const rct::keyV &a, const epee::span<const rct::key> &b, const rct::key &y) static rct::key weighted_inner_product(const rct::keyV &a, const epee::span<const rct::key> &b, const rct::key &y)
{ {
CHECK_AND_ASSERT_THROW_MES(a.size() == b.size(), "Incompatible sizes of a and b"); CHECK_AND_ASSERT_THROW_MES(a.size() == b.size(), "Incompatible sizes of a and b");
rct::key res = rct::zero(); return weighted_inner_product(epee::to_span(a), b, y);
rct::key y_power = ONE;
rct::key temp;
for (size_t i = 0; i < a.size(); ++i)
{
sc_mul(temp.bytes, a[i].bytes, b[i].bytes);
sc_mul(y_power.bytes, y_power.bytes, y.bytes);
sc_muladd(res.bytes, temp.bytes, y_power.bytes, res.bytes);
}
return res;
} }
// Fold inner-product point vectors // Fold inner-product point vectors