authorgravatar for 124872+jedisct1@users.noreply.github.comFrank Denis <124872+jedisct1@users.noreply.github.com> 2020-11-23 18:59:05+01:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2020-11-25 15:37:43-08:00
log83abb322478a148aeb6206e10f0f72e70d35c67d
treef259c28f2f56bad086960c676b4f65b3cf5b4bc1
parent58c2bec589d6d90db31744430407bc88695b5161

std/crypto - edwards25519 precomp: prefer doublings over adds

Doublings are a little bit faster than additions, so use them half the time during precomputations.

1 files changed, 1 insertions(+), 1 deletions(-)

lib/std/crypto/25519/edwards25519.zig+1-1
...@@ -221,7 +221,7 @@ pub const Edwards25519 = struct {...@@ -221,7 +221,7 @@ pub const Edwards25519 = struct {
221 pc[1] = p;221 pc[1] = p;
222 var i: usize = 2;222 var i: usize = 2;
223 while (i <= count) : (i += 1) {223 while (i <= count) : (i += 1) {
224 pc[i] = pc[i - 1].add(p);224 pc[i] = if (i % 2 == 0) pc[i / 2].dbl() else pc[i - 1].add(p);
225 }225 }
226 return pc;226 return pc;
227 }227 }