Minor optimization; split out the non-vectorizable iteration in calcql()