Sha256.packed.blocks: 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 73-120 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=73&end_line=120 import Base import mylsm-lsm-store@0.6.0.1/src/hub_sha/state.bend as S import bend-kit-bytes@0.3.2.0/bytes.bend as Packed # Read complete 64-byte blocks directly through a bounded package cursor. def packed.blocks( remaining: Nat, in_block: Nat, pair: Packed.Cursor & Maybe<&2, U32>, acc: List<&2, U32>, state: S.State ) -> Packed.Cursor & S.State: match remaining: case 0n: match pair: case (cursor, _): (cursor, state) case 1n: match in_block: case 0n: match pair: case (cursor, _): (cursor, state) case 1n: match pair: case (cursor, Some{word}): (cursor, packed.compress(List.reverse(&2, U32, word <> acc), state)) case (cursor, None{}): (cursor, state) case 1n+more: match pair: case (cursor, _): (cursor, state) case 1n+more: match in_block: case 0n: match pair: case (cursor, _): (cursor, state) case 1n: match pair: case (cursor, Some{word}): packed.blocks(more, 16n, Packed.Cursor.u32be(cursor), Nil{}, packed.compress(List.reverse(&2, U32, word <> acc), state)) case (cursor, None{}): (cursor, state) case 1n+left: match pair: case (cursor, Some{word}): packed.blocks(more, left, Packed.Cursor.u32be(cursor), word <> acc, state) case (cursor, None{}): (cursor, state) Uses (11): 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.u32be https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/hub_sha/sha256.bend&name=packed.compress https://jend.leeeet.dev/definition.txt?path=mylsm-lsm-store@0.6.0.1/src/hub_sha/state.bend&name=State