def find.go

lawful-bytes@0.1.1.0 · bytes.bend:75

import lawful-bytes@0.1.1.0/bytes.bend as Bytes
import Base
import lawful-bytes@0.1.1.0/defs.bend as D

75# hit says byte j is c; r holds byte j + 1; n counts positions left from j.
76def find.go(n: Nat, hit: Bool, r: D.Bytes & U32, +j: U32, +to: U32, +c: U32) -> D.Bytes & U32:
77  match n hit:
78    case 0n _:
79      (b, x) = r
80      (b, to)
81    case 1n+k True{}:
82      (b, x) = r
83      (b, j)
84    case 1n+k False{}:
85      (b, +x) = r
86      find.go(k, U32.is_eq(x, c), at(b, (j + 2 : U32)), (j + 1 : U32), to, c)

Uses (9)

Used by (5)