Implement sum_sqr_shift() using two passes with no branch inside the loops