Skip to content

Commit

Permalink
hm
Browse files Browse the repository at this point in the history
  • Loading branch information
jtguibas committed Jul 31, 2024
1 parent cac4737 commit fb25af3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions recursion/gnark-ffi/go/sp1/babybear/babybear.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,11 @@ func (c *Chip) MulEF(a ExtensionVariable, b Variable) ExtensionVariable {
}

func (c *Chip) InvE(in ExtensionVariable) ExtensionVariable {
in.Value[0] = c.ReduceSlow(in.Value[0])
in.Value[1] = c.ReduceSlow(in.Value[1])
in.Value[2] = c.ReduceSlow(in.Value[2])
in.Value[3] = c.ReduceSlow(in.Value[3])

result, err := c.api.Compiler().NewHint(InvEHint, 4, in.Value[0].Value, in.Value[1].Value, in.Value[2].Value, in.Value[3].Value)
if err != nil {
panic(err)
Expand All @@ -251,8 +256,8 @@ func (c *Chip) InvE(in ExtensionVariable) ExtensionVariable {
linv := Variable{Value: result[3], NbBits: 31}
out := ExtensionVariable{Value: [4]Variable{xinv, yinv, zinv, linv}}

product := c.MulE(in, out)
c.AssertIsEqualE(product, NewE([]string{"1", "0", "0", "0"}))
// product := c.MulE(in, out)
// c.AssertIsEqualE(product, NewE([]string{"1", "0", "0", "0"}))

return out
}
Expand Down

0 comments on commit fb25af3

Please sign in to comment.