Protocol.b64go: def of bendonnect-rpc@0.1.0.0 Import: import bendonnect-rpc@0.1.0.0/src/protocol.bend as Protocol Lines 498-510 of bendonnect-rpc@0.1.0.0/src/protocol.bend: https://jend.leeeet.dev/read.txt?path=bendonnect-rpc@0.1.0.0/src/protocol.bend&start_line=498&end_line=510 import Base import bend-kit-bytes@0.3.2.0/bytes.bend as Bytes # Fills out from the 6-bit values; None on a dangling single char. def b64go(vs: List<&2, U32>, out: Bytes.Bytes, +i: U32) -> Maybe<&1, Bytes.Bytes>: match vs: case Nil{}: Some{out} case Con{+a, Nil{}}: None{} case Con{+a, Con{+b, Nil{}}}: Some{b64set(out, i, ((a << 2n) .|. (b >> 4n) : U32))} case Con{+a, Con{+b, Con{+c, Nil{}}}}: Some{b64set(b64set(out, i, ((a << 2n) .|. (b >> 4n) : U32)), (i + 1 : U32), (((b .&. 15 : U32) << 4n) .|. (c >> 2n) : U32))} case Con{+a, Con{+b, Con{+c, Con{+d, rest}}}}: b64go(rest, b64set(b64set(b64set(out, i, ((a << 2n) .|. (b >> 4n) : U32)), (i + 1 : U32), (((b .&. 15 : U32) << 4n) .|. (c >> 2n) : U32)), (i + 2 : U32), (((c .&. 3 : U32) << 6n) .|. d : U32)), (i + 3 : U32)) Uses (10): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Maybe 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=Base/base.bend&name=U32.or https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shln https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.shrn https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes https://jend.leeeet.dev/definition.txt?path=bendonnect-rpc@0.1.0.0/src/protocol.bend&name=b64set