#include #include "minwise.h" #include "assert.h" irreduciblePolynomial::irreduciblePolynomial(int n_){ n=n_; f=new char[n+1]; #ifdef DEBUG printf("Generating Irreducible_polynomial of degree %d\n",n); int count=0; #endif for(int i=1;i=dx){ for(int j=0;j1&&t[dt-1]==0)dt--; } /* notice t might be 0 with dt=1 t[0]=0 */ //u=t du=dt; for(int j=0;j1&&t[dt-1]==0)dt--; } /* if t=0 , gcd(0,x) will be 0 */ if(dt==1&&t[0]==0){ delete []u; delete []t; delete []c; return 0; /* blow it! */ } //c=x; dc=dx; for(int j=0;j=dt); while(dc>0&&dt>0){ if(sw){//dc>=dt c=c%t while(dc>=dt){ for(int j=0;j0&&c[dc-1]==0)dc--; } }else{//dc<=dt t=t%c; while(dt>=dc){ for(int j=0;j0&&t[dt-1]==0)dt--; } } sw=!sw; } if(dt>1||dc>1){ //gcd(t,x)=1; delete []u; delete []t; delete []c; return 0; } } delete []u; delete []t; delete []c; return 1; } LFSR::LFSR(int m_){ m=m_; s=new char[m+1]; for(int i=0;igetBits()+1); r=new char[m+1]; for(int i=0;i=t){ char b=0; for(int i=0;i