TensorFile.framed: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/tensor_file.bend as TensorFile Lines 406-410 of stelliferous@0.0.2.0/tensor_file.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/tensor_file.bend&start_line=406&end_line=410 import Base # Version 1: the header ends in a newline and the data starts at a multiple of 64 bytes. def framed(+text: List<&2,U32>,+length: U32) -> List<&2,U32>: +padding = ((64 - (11 + length) % 64) % 64 : U32) +total = (length + padding + 1 : U32) List.append(&2,U32,magic(),1 <> 0 <> (total % 256 : U32) <> (total / 256 : U32) <> List.append(&2,U32,text,spaces(U32.to_nat(padding)))) 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=List.append 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.div https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.mod https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.to_nat https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_file.bend&name=magic https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/tensor_file.bend&name=spaces