compute_align function

Align positions using length.