This was the way SG's code was that I borrowed.  I didn't try turning them into templates and just passing duals, because I was looking at this code thinking "this looks straightforward to replace with SSE", and that would be all screwed up with duals.