def Gfm.log.go

bend-osdev-gf@0.1.1.0 · gfm.bend:108

import bend-osdev-gf@0.1.1.0/gfm.bend as Gfm
import Base

108# the least i with x^i = a, searching i below 2^m - 1 (0 for a = 0)
109def Gfm.log.go(n: Nat, hit: Bool, +f: GfmField, +a: U32, +cur: U32, +i: U32) -> U32:
110  match n hit:
111    case _ True{}:
112      i
113    case 0n False{}:
114      0
115    case 1n+k False{}:
116      +nxt = Gfm.xtime(f, cur)
117      Gfm.log.go(k, U32.is_eq(nxt, a), f, a, nxt, U32.add(i, 1))

Uses (7)

Used by (1)