bend-kit-bytes Releases (5): 0.3.3.0 0x632652e3c1c0183f12728faf3870bb68 indexed https://jend.leeeet.dev/files.txt?path=bend-kit-bytes@0.3.3.0 0.3.2.0 0x185ae03c75e3e75be1171471f68b43cb unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-bytes@0.3.2.0 0.3.1.0 0xb7603dcfa1d7f60d01e06c928738cc73 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-bytes@0.3.1.0 0.3.0.0 0x49814d83de8f70993a43e1002be29ecd unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-bytes@0.3.0.0 0.2.0.0 0xbf22530d1ea11c951d1ecaa353ed1580 unindexed https://jend.leeeet.dev/files.txt?path=bend-kit-bytes@0.2.0.0 Definitions (161, 1 to 100 shown): Bytes.Bytes (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=Bytes) type Bytes is Type: Bytes{len: U32, buf: Array} Bytes.b8 (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=b8) def b8(+x: U32) -> U32: Bytes.shift (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=shift) def shift(+i: U32) -> Nat: Bytes.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=words) def words(+n: U32) -> U32: Bytes.depth.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=depth.go) # The fewest d with 2^d >= w. def depth.go(f: Nat, more: Bool, +w: U32, +d: Nat, +cap: U32) -> Nat: Bytes.depth (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=depth) def depth(+w: U32) -> Nat: Bytes.alloc (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=alloc) def alloc(+n: U32) -> Array: Bytes.peek.of (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=peek.of) # Unchecked byte read and write. Callers keep i below len. def peek.of(+sh: Nat, r: Array & U32) -> Array & U32: Bytes.peek (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=peek) def peek(a: Array, +i: U32) -> Array & U32: Bytes.poke.of (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=poke.of) def poke.of(+i: U32, +v: U32, r: Array & U32) -> Array: Bytes.poke (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=poke) def poke(a: Array, +i: U32, +v: U32) -> Array: Bytes.copy.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy.go) # n bytes from src[s..] to dst[d..], one byte at a time. def copy.go(n: Nat, r: Array & U32, dst: Array, +s: U32, +d: U32) -> Array & Array: Bytes.copy.bytes (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy.bytes) def copy.bytes(+m: U32, src: Array, dst: Array, +s: U32, +d: U32) -> Array & Array: Bytes.copy.words (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy.words) # n words from src[s..] to dst[d..] (word indexes). def copy.words(n: Nat, r: Array & U32, dst: Array, +s: U32, +d: U32) -> Array & Array: Bytes.copy.shift (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy.shift) # m bytes to a word-aligned d from an unaligned s: each out word joins two source words. # lo = 8*(s%4) and hi = 32 - lo; r holds source word k, prev the word before it. def copy.shift(n: Nat, +lo: Nat, +hi: Nat, +prev: U32, r: Array & U32, dst: Array, +k: U32, +d: U32) -> Array & Array: Bytes.copy.shift.at (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy.shift.at) def copy.shift.at(+w: U32, +lo: U32, +k: U32, +d: U32, r: Array & U32, dst: Array) -> Array & Array: Bytes.copy.tail (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy.tail) def copy.tail(+m: U32, +s: U32, +d: U32, r: Array & Array) -> Array & Array: Bytes.copy.pick (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy.pick) def copy.pick(aligned: Bool, +m: U32, src: Array, dst: Array, +s: U32, +d: U32) -> Array & Array: Bytes.copy.dst (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy.dst) def copy.dst(daligned: Bool, +m: U32, src: Array, dst: Array, +s: U32, +d: U32) -> Array & Array: Bytes.copy (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=copy) # m bytes from src[s..] to dst[d..]. Whole words when d is word-aligned, shifted when s is not. # ponytail: an unaligned d (append after an odd length) copies bytes; merge into d's first word if that gets hot. def copy(+m: U32, src: Array, dst: Array, +s: U32, +d: U32) -> Array & Array: Bytes.new (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=new) # n zero bytes. def new(+n: U32) -> Bytes: Bytes.length (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=length) def length(b: Bytes) -> Bytes & U32: Bytes.get.some (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get.some) def get.some(+len: U32, r: Array & U32) -> Bytes & Maybe<&2, U32>: Bytes.get.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get.if) def get.if(ok: Bool, +len: U32, buf: Array, +i: U32) -> Bytes & Maybe<&2, U32>: Bytes.get (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get) # Byte i, or None when i >= len. def get(b: Bytes, +i: U32) -> Bytes & Maybe<&2, U32>: Bytes.set.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=set.if) def set.if(ok: Bool, +len: U32, buf: Array, +i: U32, +v: U32) -> Bytes: Bytes.set (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=set) # Byte i becomes v & 255. Nothing changes when i >= len. def set(b: Bytes, +i: U32, +v: U32) -> Bytes: Bytes.step (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=step) # The next index: one forward when up, one back when not. def step(+up: Bool, +i: U32) -> U32: Bytes.fits (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=fits) # Do n bytes from i fit in len? def fits(+len: U32, +i: U32, +n: U32) -> Bool: Bytes.uint.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=uint.go) # n bytes from j, each shifted in below the ones before: the first byte read is the most significant. def uint.go(n: Nat, r: Array & U32, +j: U32, +up: Bool, +acc: U32) -> Array & U32: Bytes.uint.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=uint.if) # Big-endian reads forward from i; little-endian reads back from the last byte. def uint.if(ok: Bool, +len: U32, buf: Array, +i: U32, +n: U32, +be: Bool) -> Bytes & Maybe<&2, U32>: Bytes.uint (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=uint) def uint(b: Bytes, +i: U32, +n: U32, +be: Bool) -> Bytes & Maybe<&2, U32>: Bytes.get.u16be (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get.u16be) # Unsigned integers at byte i, or None when they run past len. # be: most significant byte first (network order); le: least significant first. def get.u16be(b: Bytes, +i: U32) -> Bytes & Maybe<&2, U32>: Bytes.get.u16le (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get.u16le) def get.u16le(b: Bytes, +i: U32) -> Bytes & Maybe<&2, U32>: Bytes.get.u32be (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get.u32be) def get.u32be(b: Bytes, +i: U32) -> Bytes & Maybe<&2, U32>: Bytes.get.u32le (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get.u32le) def get.u32le(b: Bytes, +i: U32) -> Bytes & Maybe<&2, U32>: Bytes.put.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=put.go) # n bytes of v from j, least significant first. def put.go(n: Nat, a: Array, +j: U32, +up: Bool, +v: U32) -> Array: Bytes.put.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=put.if) # Little-endian writes forward from i; big-endian writes back from the last byte. def put.if(ok: Bool, +len: U32, buf: Array, +i: U32, +n: U32, +be: Bool, +v: U32) -> Bytes: Bytes.put (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=put) def put(b: Bytes, +i: U32, +n: U32, +be: Bool, +v: U32) -> Bytes: Bytes.set.u16be (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=set.u16be) # v's low 16 or 32 bits at byte i. Nothing changes when they would run past len. def set.u16be(b: Bytes, +i: U32, +v: U32) -> Bytes: Bytes.set.u16le (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=set.u16le) def set.u16le(b: Bytes, +i: U32, +v: U32) -> Bytes: Bytes.set.u32be (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=set.u32be) def set.u32be(b: Bytes, +i: U32, +v: U32) -> Bytes: Bytes.set.u32le (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=set.u32le) def set.u32le(b: Bytes, +i: U32, +v: U32) -> Bytes: Bytes.u64.of (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=u64.of) # The U64 whose words, in byte order, are x then y. def u64.of(be: Bool, +x: U32, +y: U32) -> Int.U64: Bytes.u64.join (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=u64.join) def u64.join(+be: Bool, x: Maybe<&2, U32>, y: Maybe<&2, U32>) -> Maybe<&2, Int.U64>: Bytes.u64.lo (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=u64.lo) def u64.lo(+be: Bool, x: Maybe<&2, U32>, r: Bytes & Maybe<&2, U32>) -> Bytes & Maybe<&2, Int.U64>: Bytes.u64.hi (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=u64.hi) def u64.hi(+i: U32, +be: Bool, r: Bytes & Maybe<&2, U32>) -> Bytes & Maybe<&2, Int.U64>: Bytes.u64 (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=u64) def u64(b: Bytes, +i: U32, +be: Bool) -> Bytes & Maybe<&2, Int.U64>: Bytes.get.u64be (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get.u64be) # A U64 at byte i, or None when its 8 bytes run past len. def get.u64be(b: Bytes, +i: U32) -> Bytes & Maybe<&2, Int.U64>: Bytes.get.u64le (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=get.u64le) def get.u64le(b: Bytes, +i: U32) -> Bytes & Maybe<&2, Int.U64>: Bytes.put64.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=put64.if) # Writes words x then y at byte i, both in the same byte order. def put64.if(ok: Bool, +len: U32, buf: Array, +i: U32, +be: Bool, +x: U32, +y: U32) -> Bytes: Bytes.put64 (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=put64) def put64(b: Bytes, +i: U32, +be: Bool, +v: Int.U64) -> Bytes: Bytes.set.u64be (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=set.u64be) # v at byte i. Nothing changes when its 8 bytes would run past len. def set.u64be(b: Bytes, +i: U32, +v: Int.U64) -> Bytes: Bytes.set.u64le (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=set.u64le) def set.u64le(b: Bytes, +i: U32, +v: Int.U64) -> Bytes: Bytes.count (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=count) # String.length counts in Nat, which costs more than the walk itself. def count(s: String, +n: U32) -> U32: Bytes.flush (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=flush) # Bytes enter at the top of w and shift down, so a full word has byte 0 lowest. def flush(full: Bool, a: Array, +k: U32, +w: U32) -> Array: Bytes.from.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=from.go) def from.go(s: String, a: Array, +i: U32, +w: U32) -> Array: Bytes.from_string (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=from_string) # A byte string (one Char per octet, as Wire and Http use) to Bytes. Each Char keeps its low 8 bits. def from_string(+s: String) -> Bytes: Bytes.to.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=to.go) def to.go(n: Nat, r: Array & U32, +i: U32, acc: String) -> String: Bytes.to_string (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=to_string) # Bytes to a byte string, one Char per octet. def to_string(b: Bytes) -> String: Bytes.slice.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=slice.fin) def slice.fin(+len: U32, +m: U32, r: Array & Array) -> Bytes & Bytes: Bytes.slice.at (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=slice.at) def slice.at(+len: U32, buf: Array, +s: U32, +m: U32) -> Bytes & Bytes: Bytes.slice (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=slice) # The buffer back, and a copy of up to n bytes from start. Both ends are clamped to len. def slice(b: Bytes, +start: U32, +n: U32) -> Bytes & Bytes: Bytes.clone.of (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=clone.of) def clone.of(+len: U32, r: Array & Array) -> Bytes & Bytes: Bytes.clone (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=clone) # Two buffers that hold the same bytes. def clone(b: Bytes) -> Bytes & Bytes: Bytes.dst (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=dst) def dst(r: Array & Array) -> Array: Bytes.room (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=room) # Does a buffer holding len bytes have room for n? Its 2^d words fit the fewest that hold len. def room(+len: U32, +n: U32) -> Bool: Bytes.grow.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=grow.if) def grow.if(fits: Bool, +len: U32, buf: Array, +n: U32) -> Array: Bytes.grow (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=grow) # buf, or a copy of its first len bytes in the fewest 2^d words that hold n. def grow(+len: U32, buf: Array, +n: U32) -> Array: Bytes.append (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=append) # a then b. b is written into a's buffer while it has room, and the buffer at least # doubles when it runs out, so building a buffer one piece at a time is O(total). def append(a: Bytes, b: Bytes) -> Bytes: Bytes.concat.total.con (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=concat.total.con) def concat.total.con(x: Bytes, r: List<&1, Bytes> & U32) -> List<&1, Bytes> & U32: Bytes.concat.total (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=concat.total) def concat.total(xs: List<&1, Bytes>, +n: U32) -> List<&1, Bytes> & U32: Bytes.concat.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=concat.go) def concat.go(xs: List<&1, Bytes>, out: Array, +at: U32) -> Array: Bytes.concat.of (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=concat.of) def concat.of(r: List<&1, Bytes> & U32) -> Bytes: Bytes.concat (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=concat) # The pieces in order, in one new buffer: one copy per byte, however many pieces. def concat(xs: List<&1, Bytes>) -> Bytes: Bytes.at.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=at.go) # Does needle match at j? ok is the previous byte's result; the first mismatch stops the walk. def at.go(needle: String, ok: Bool, r: Array & U32, +j: U32) -> Array & Bool: Bytes.at (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=at) def at(a: Array, +needle: String, +j: U32) -> Array & Bool: Bytes.find.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=find.go) # ponytail: naive search; a mismatch costs one byte read per position, but a repetitive needle is O(len * needle). Add a SWAR scan or two-way search if find gets hot. # f counts the positions left after i. def find.go(f: Nat, r: Array & Bool, +needle: String, +i: U32, +up: Bool) -> Array & Maybe<&2, U32>: Bytes.find.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=find.fin) def find.fin(+len: U32, r: Array & Maybe<&2, U32>) -> Bytes & Maybe<&2, U32>: Bytes.find.at (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=find.at) def find.at(none: Bool, +len: U32, buf: Array, +needle: String, +i: U32, +f: U32, +up: Bool) -> Bytes & Maybe<&2, U32>: Bytes.find.from (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=find.from) # Index of the first match of needle (a byte string) at or after start, or None. # An empty needle matches at start when start <= len. def find.from(b: Bytes, +needle: String, +start: U32) -> Bytes & Maybe<&2, U32>: Bytes.find (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=find) # Index of the first match of needle (a byte string), or None. An empty needle matches at 0. def find(b: Bytes, +needle: String) -> Bytes & Maybe<&2, U32>: Bytes.rfind (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=rfind) # Index of the last match of needle, or None. An empty needle matches at len. def rfind(b: Bytes, +needle: String) -> Bytes & Maybe<&2, U32>: Bytes.at.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=at.fin) def at.fin(+len: U32, r: Array & Bool) -> Bytes & Bool: Bytes.at.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=at.if) def at.if(fits: Bool, +len: U32, buf: Array, +needle: String, +j: U32) -> Bytes & Bool: Bytes.starts_with (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=starts_with) # Does b begin with prefix (a byte string)? def starts_with(b: Bytes, +prefix: String) -> Bytes & Bool: Bytes.ends_with (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=ends_with) # Does b end with suffix (a byte string)? def ends_with(b: Bytes, +suffix: String) -> Bytes & Bool: Bytes.split.scan (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=split.scan) # Match positions of sep, latest first, that do not overlap an earlier match. # f counts the positions left; skip counts the bytes still inside the last match. def split.scan(f: Nat, r: Array & Bool, +sep: String, +m: U32, +i: U32, +skip: U32, +cuts: List<&2, U32>) -> Array & List<&2, U32>: Bytes.snd (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=snd) def snd(r: Bytes & Bytes) -> Bytes: Bytes.split.cut (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=split.cut) # r holds the buffer and the piece that ends at end; each earlier cut j starts one at j + m. def split.cut(cuts: List<&2, U32>, r: Bytes & Bytes, +end: U32, +m: U32, acc: List<&1, Bytes>) -> List<&1, Bytes>: Bytes.split.of (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=split.of) def split.of(cuts: List<&2, U32>, b: Bytes, +len: U32, +m: U32) -> List<&1, Bytes>: Bytes.split.run (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=split.run) def split.run(+len: U32, +m: U32, r: Array & List<&2, U32>) -> List<&1, Bytes>: Bytes.split.if (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=split.if) def split.if(whole: Bool, +len: U32, buf: Array, +sep: String, +m: U32) -> List<&1, Bytes>: Bytes.split (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=split) # The pieces between matches of sep (a byte string), left to right. n matches give n + 1 # pieces, so a match at either end gives an empty piece. An empty sep gives b whole. def split(b: Bytes, +sep: String) -> List<&1, Bytes>: Bytes.eq.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=eq.go) # Compares whole words; same tells whether the previous pair matched. def eq.go(n: Nat, same: Bool, r: Array & U32, s: Array & U32, +i: U32) -> Array & Array & Bool: Bytes.eq.fin (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=eq.fin) def eq.fin(+la: U32, +lb: U32, r: Array & Array & Bool) -> Bytes & Bytes & Bool: Bytes.eq.len (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=eq.len) def eq.len(same: Bool, +la: U32, xa: Array, +lb: U32, ya: Array) -> Bytes & Bytes & Bool: Bytes.eq (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=eq) # Both buffers back, and whether they hold the same bytes. def eq(a: Bytes, b: Bytes) -> Bytes & Bytes & Bool: Bytes.bswap (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=bswap) # Byte 0 of w becomes the most significant, so words compare in byte order. def bswap(+w: U32) -> U32: Bytes.cmp.go (https://jend.leeeet.dev/definition.txt?path=bend-kit-bytes@0.3.3.0/bytes.bend&name=cmp.go) # Compares whole words; c is the previous pair's order. def cmp.go(n: Nat, c: Cmp, r: Array & U32, s: Array & U32, +i: U32) -> Array & Array & Cmp: More: https://jend.leeeet.dev/packages/bend-kit-bytes.txt?definitions_offset=100