Merge xgcd_partial from qfb branch.