KernelPackingSamples.pixel_address: def of stelliferous@0.0.2.0 Import: import stelliferous@0.0.2.0/kernel_packing_samples.bend as KernelPackingSamples Lines 34-39 of stelliferous@0.0.2.0/kernel_packing_samples.bend: https://jend.leeeet.dev/read.txt?path=stelliferous@0.0.2.0/kernel_packing_samples.bend&start_line=34&end_line=39 import Base def pixel_address(context: PixelBlock,index: Nat) -> PixelAddress: PixelBlock{position,kernel_row,kernel_column,channel_base,+height,+width,+stride,+padding,+output_width} = context +position = (position + U32.from_nat(index) : U32) +row = (position / output_width * stride + kernel_row - padding : U32) +column = (position % output_width * stride + kernel_column - padding : U32) PixelAddress{(channel_base + row * width + column : U32),U32.is_lt(row,height) && U32.is_lt(column,width)} Uses (12): https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Bool.and https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=Nat 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.from_nat https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.is_lt 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.mul https://jend.leeeet.dev/definition.txt?path=Base/base.bend&name=U32.sub https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_packing_samples.bend&name=PixelAddress https://jend.leeeet.dev/definition.txt?path=stelliferous@0.0.2.0/kernel_packing_samples.bend&name=PixelBlock