INNER CODE UNIT · Go
NafDecomposition
Consensys/gnark-crypto · ecc/utils.go:12
func NafDecomposition(a *big.Int, result []int8) int {
var zero, one, two, three big.Int
one.SetUint64(1)
two.SetUint64(2)
three.SetUint64(3)
length := 0
// some buffers
var buf, aCopy big.Int
aCopy.Set(a)
for aCopy.Cmp(&zero) != 0 {
// if aCopy % 2 == 0
buf.And(&aCopy, &one)