Skip to content

Commit

Permalink
perf: small optim in jointScalarMulGLV
Browse files Browse the repository at this point in the history
  • Loading branch information
yelhousni committed Feb 16, 2024
1 parent 5cd0913 commit 10c242a
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions std/algebra/emulated/sw_emulated/point.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,16 +810,14 @@ func (c *Curve[B, S]) jointScalarMulGLVUnsafe(Q, R *AffinePoint[B], s, t *emulat
tableS[2] = c.Add(tableS[2], tableR[0])
tableS[3] = c.Neg(tableS[2])
f0 := c.baseApi.Mul(&tableS[0].X, c.thirdRootOne)
f1 := c.baseApi.Mul(&tableS[1].X, c.thirdRootOne)
f2 := c.baseApi.Mul(&tableS[2].X, c.thirdRootOne)
f3 := c.baseApi.Mul(&tableS[3].X, c.thirdRootOne)
tablePhiS[0] = &AffinePoint[B]{
X: *c.baseApi.Lookup2(selector2, selector4, f0, f2, f3, f1),
X: *c.baseApi.Select(c.api.Xor(selector2, selector4), f2, f0),
Y: *c.baseApi.Lookup2(selector2, selector4, &tableS[0].Y, &tableS[2].Y, &tableS[3].Y, &tableS[1].Y),
}
tablePhiS[1] = c.Neg(tablePhiS[0])
tablePhiS[2] = &AffinePoint[B]{
X: *c.baseApi.Lookup2(selector2, selector4, f2, f0, f1, f3),
X: *c.baseApi.Select(c.api.Xor(selector2, selector4), f0, f2),
Y: *c.baseApi.Lookup2(selector2, selector4, &tableS[2].Y, &tableS[0].Y, &tableS[1].Y, &tableS[3].Y),
}
tablePhiS[3] = c.Neg(tablePhiS[2])
Expand Down

0 comments on commit 10c242a

Please sign in to comment.