Shift-and-add algorithms