std/crypto - edwards25519 precomp: prefer doublings over adds

Doublings are a little bit faster than additions, so use them half
the time during precomputations.
master
Frank Denis 2020-11-23 18:59:05 +01:00 committed by Andrew Kelley
parent 58c2bec589
commit 83abb32247
1 changed files with 1 additions and 1 deletions

View File

@ -221,7 +221,7 @@ pub const Edwards25519 = struct {
pc[1] = p;
var i: usize = 2;
while (i <= count) : (i += 1) {
pc[i] = pc[i - 1].add(p);
pc[i] = if (i % 2 == 0) pc[i / 2].dbl() else pc[i - 1].add(p);
}
return pc;
}