Skip to content

Commit

Permalink
bw6761: faster e3 MulBy01
Browse files Browse the repository at this point in the history
  • Loading branch information
shramee committed Mar 9, 2024
1 parent 859ee92 commit c2a37fd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions std/algebra/emulated/fields_bw6761/e3.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,10 @@ func (e Ext3) MulBy01(z *E3, c0, c1 *baseEl) *E3 {
t0 = e.fp.MulConst(t0, big.NewInt(4))
t0 = e.fp.Add(t0, a)

tmp = e.fp.Add(&z.A0, &z.A2)
t2 := e.fp.Mul(c0, tmp)
t2 = e.fp.Sub(t2, a)
// for t2, schoolbook is faster than karatsuba
// c2 = a0b2 + a1b1 + a2b0,
// c2 = a2b0 + b ∵ b2 = 0, b = a1b1
t2 := e.fp.Mul(&z.A2, c0)
t2 = e.fp.Add(t2, b)

t1 := e.fp.Add(c0, c1)
Expand Down

0 comments on commit c2a37fd

Please sign in to comment.