Sha256.packed.tail: def of mylsm-lsm-store@0.6.0.1 Import: import mylsm-lsm-store@0.6.0.1/src/hub_sha/sha256.bend as Sha256 Lines 122-145 of mylsm-lsm-store@0.6.0.1/src/hub_sha/sha256.bend: https://jend.leeeet.dev/read.txt?path=mylsm-lsm-store@0.6.0.1/src/hub_sha/sha256.bend&start_line=122&end_line=145 import Base import bend-kit-bytes@0.3.2.0/bytes.bend as Packed # Read the remaining fewer than 64 bytes for the existing constant-space tail # padding routines. This list is bounded by 63 octets, regardless of file size. def packed.tail( remaining: Nat, pair: Packed.Cursor & Maybe<&2, U32>, acc: List<&2, U32> ) -> Packed.Cursor & List<&2, U32>: match remaining: case 0n: match pair: case (cursor, _): (cursor, List.reverse(&2, U32, acc)) case 1n: match pair: case (cursor, Some{byte}): (cursor, List.reverse(&2, U32, byte <> acc)) case (cursor, None{}): (cursor, Nil{}) case 1n+more: match pair: case (cursor, Some{byte}): packed.tail(more, Packed.Cursor.u8(cursor), byte <> acc) case (cursor, None{}): (cursor, Nil{}) Uses (9): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=List.reverse 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=Sigma https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32 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-bytes@0.3.3.0/bytes.bend&name=Cursor.u8