Protobuf.varint.go: def of bend-kit-protobuf@0.2.0.0 Import: import bend-kit-protobuf@0.2.0.0/protobuf.bend as Protobuf Lines 109-128 of bend-kit-protobuf@0.2.0.0/protobuf.bend: https://jend.leeeet.dev/read.txt?path=bend-kit-protobuf@0.2.0.0/protobuf.bend&start_line=109&end_line=128 import Base import bend-kit-bytes@0.3.3.0/bytes.bend as B # The last byte must fit its word; its continuation bit is never allowed. def varint.go(fuel: Nat, r: B.Cursor & Maybe<&2, VarintByte>, +i: U32, +last: U32, +max_last: U32, w: Word64) -> Result<&2, &1, Error, B.Cursor & Word64>: match fuel: case 0n: Fail{Malformed{}} case 1n+p: (c, v) = r match v: case None{}: Fail{Incomplete{}} case Some{VarintByte{bad, done, b}}: match bad: case True{}: Fail{Malformed{}} case False{}: match done: case True{}: Done{(c, varint.add(i, (b .&. 127 : U32), w))} case False{}: varint.go(p, varint.read((i + 1 : U32), last, max_last, c), (i + 1 : U32), last, max_last, varint.add(i, (b .&. 127 : U32), w)) Uses (15): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Pair https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Result https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.add https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.and https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Cursor https://jend.leeeet.dev/definition.txt?path=bend-kit-protobuf@0.2.0.0/protobuf.bend&name=Error https://jend.leeeet.dev/definition.txt?path=bend-kit-protobuf@0.2.0.0/protobuf.bend&name=VarintByte https://jend.leeeet.dev/definition.txt?path=bend-kit-protobuf@0.2.0.0/protobuf.bend&name=Word64 https://jend.leeeet.dev/definition.txt?path=bend-kit-protobuf@0.2.0.0/protobuf.bend&name=varint.add https://jend.leeeet.dev/definition.txt?path=bend-kit-protobuf@0.2.0.0/protobuf.bend&name=varint.read