swr: reorder/redesign operations to avoid integer overflow.