def find.go

lawful-bytes@0.1.1.0 · fast.bend:51

import lawful-bytes@0.1.1.0/fast.bend as Fast
import Base

51# m flags word wi's hits; z: m is 0; r holds word wi + 1; n counts the words
52# left, wi's included. Answers the offset of the first hit, or 2^32 - 1.
53def find.go(n: Nat, z: Bool, r: Array<U32> & U32, +wi: U32, +m: U32, +rc: U32) -> Array<U32> & U32:
54  match n z:
55    case 0n _:
56      (a, w) = r
57      (a, 4294967295)
58    case 1n+k True{}:
59      (a, +w) = r
60      +m2 = zb((w .^. rc : U32))
61      find.go(k, U32.is_zero(m2), Array.get(U32, a, (wi + 2 : U32)), (wi + 1 : U32), m2, rc)
62    case 1n+k False{}:
63      (a, w) = r
64      (a, ((wi << 2n : U32) + bidx(m) : U32))

Uses (13)

Used by (3)