/******************************************************************************/ /* */ /* CHECK FOR COMMON FACTORS */ /* 09/23/05 (dkc) */ /* */ /******************************************************************************/ extern unsigned int recip[]; void midprod(unsigned int a, unsigned int b, unsigned int *output); void differ(unsigned int *a, unsigned int *b); unsigned int comfact(unsigned int a, unsigned int b, unsigned int count) { unsigned int i; unsigned int T[2],U[2],X[2],flag,flag0,flag1; flag=0; for (i=0; i<count; i++) { flag0=0; midprod(recip[2*i], a, X); midprod(recip[2*i+1], X[0], X); T[0]=0; T[1]=X[1]; U[0]=0; U[1]=a; differ(U, T); if ((T[0]==0)&&(T[1]==0)) flag0=1; flag1=0; midprod(recip[2*i], b, X); midprod(recip[2*i+1], X[0], X); T[0]=0; T[1]=X[1]; U[0]=0; U[1]=b; differ(U, T); if ((T[0]==0)&&(T[1]==0)) flag1=1; if ((flag0==1)&&(flag1==1)) { flag=1; break; } } return flag; }