gcd_pf_pow: get rid of duplicate code.