def gather_width_when
import stelliferous@0.0.2.0/kernel_gather.bend as KernelGatherimport Base
4# Clip once per leaf. A channel is one contiguous copy; padding never becomes
5# a store into the next channel. Both owners stay affine across the channel loop.
6def gather_width_when(inside: Bool,offset: U32,output_positions: U32,span: U32) -> U32:
7 match inside:
8 case False{}: 0
9 case True{}: U32.min(span,(output_positions - offset : U32))