One-loop helicity amplitudes for all 2 → 2 processes in QCD and N = 1 supersymmetric Yang-Mills theory