def Gf8.log.go

bend-osdev-gf@0.1.1.0 · gf.bend:161

import bend-osdev-gf@0.1.1.0/gf.bend as Gf
import Base

161# the least i with gen^i = a (searching i = 0 to 254); 0 for a = 0, or when
162# gen does not generate a
163def Gf8.log.go(n: Nat, hit: Bool, +f: Gf8Field, +a: U32, +cur: U32, +i: Nat) -> Nat:
164  match n hit:
165    case _ True{}:
166      i
167    case 0n False{}:
168      0n
169    case 1n+k False{}:
170      +nxt = Gf8.mul(f, Gf8.gen(f), cur)
171      Gf8.log.go(k, U32.is_eq(nxt, a), f, a, nxt, 1n+i)

Uses (7)

Used by (3)