bulletproofs: some more minor speedup

This commit is contained in:
moneromooo-monero 2018-08-08 21:20:50 +00:00
parent c415df97bd
commit bf8e4b9870
No known key found for this signature in database
GPG Key ID: 686F07454D6CEFC3
1 changed files with 4 additions and 6 deletions

View File

@ -86,11 +86,9 @@ static inline rct::key multiexp(const std::vector<MultiexpData> &data, bool HiGi
return data.size() <= 64 ? straus(data, NULL, 0) : pippenger(data, NULL, get_pippenger_c(data.size())); return data.size() <= 64 ? straus(data, NULL, 0) : pippenger(data, NULL, get_pippenger_c(data.size()));
} }
static bool is_reduced(const rct::key &scalar) static inline bool is_reduced(const rct::key &scalar)
{ {
rct::key reduced = scalar; return sc_check(scalar.bytes) == 0;
sc_reduce32(reduced.bytes);
return scalar == reduced;
} }
static void add_acc_p3(ge_p3 *acc_p3, const rct::key &point) static void add_acc_p3(ge_p3 *acc_p3, const rct::key &point)
@ -139,8 +137,8 @@ static void init_exponents()
Gi[i] = get_exponent(rct::H, i * 2 + 1); Gi[i] = get_exponent(rct::H, i * 2 + 1);
CHECK_AND_ASSERT_THROW_MES(ge_frombytes_vartime(&Gi_p3[i], Gi[i].bytes) == 0, "ge_frombytes_vartime failed"); CHECK_AND_ASSERT_THROW_MES(ge_frombytes_vartime(&Gi_p3[i], Gi[i].bytes) == 0, "ge_frombytes_vartime failed");
data.push_back({rct::zero(), Gi[i]}); data.push_back({rct::zero(), Gi_p3[i]});
data.push_back({rct::zero(), Hi[i]}); data.push_back({rct::zero(), Hi_p3[i]});
} }
straus_HiGi_cache = straus_init_cache(data, STRAUS_SIZE_LIMIT); straus_HiGi_cache = straus_init_cache(data, STRAUS_SIZE_LIMIT);