arnaucube
arnaucube/gnark-plonky2-verifierPublic Self-hosted repository
gnark-plonky2-verifier/goldilocks/goldilocks.go
goldilocks/goldilocks.goRaw
 1package goldilocks
 2
 3import (
 4	"github.com/consensys/gnark/frontend"
 5	"github.com/consensys/gnark/std/math/emulated"
 6)
 7
 8type GoldilocksElement = emulated.Element[emulated.Goldilocks]
 9
10func NewGoldilocksElement(x uint64) GoldilocksElement {
11	return GoldilocksElement(emulated.NewElement[emulated.Goldilocks](x))
12}
13
14func NewGoldilocksAPI(api frontend.API) frontend.API {
15	goldilocks, err := emulated.NewField[emulated.Goldilocks](api)
16	if err != nil {
17		panic(err)
18	}
19	return goldilocks
20}