def get_block_cell_value
import bend-edit-distance@0.2.2.0/src/Myers.bend as Myersimport Base
133# getBlockCellValues(block)[W], without constructing the other 31 cells.
134# Walking up a row subtracts its positive vertical difference and adds its
135# negative difference. W is always in 0..31, never a whole extra block.
136def get_block_cell_value(padding: Nat, +pv: U32, +mv: U32, score: U32) -> U32:
137 match padding:
138 case 0n:
139 score
140 case 1n+p:
141 get_block_cell_value(p, U32.shl(pv), U32.shl(mv),
142 U32.add(U32.sub(score, U32.shrn(pv, 31n)), U32.shrn(mv, 31n)))