Quantcast
Channel: Tools
Viewing all articles
Browse latest Browse all 91752

Forum Post: RE: _gmpy4 from the host intrinsics package not working as expected

$
0
0

hi guys

the polynomial division was diverging for GF(64), hence the endless loop. the following patch made it work for me, and passes all the unit tests i have:

Index: hostport/C6xSimulator.c =================================================================== --- hostport/C6xSimulator.c     (revision 322703) +++ hostport/C6xSimulator.c     (revision 338579) @@ -1323,29 +1322,28 @@    /* multiply the four sets of polynomials together */    for(k=0;k<8;k++)      { -      c = mask&a32.x4u.hi2; +      c = (mask&a32.x4u.hi2) >> (8-m);        ytmp[3] ^= b32.x4u.hi2*c;   -      c = mask&a32.x4u.hi1; +      c = (mask&a32.x4u.hi1) >> (8-m);        ytmp[2] ^= b32.x4u.hi1*c;   -      c = mask&a32.x4u.lo2; +      c = (mask&a32.x4u.lo2) >> (8-m);        ytmp[1] ^= b32.x4u.lo2*c;   -      c = mask&a32.x4u.lo1; +      c = (mask&a32.x4u.lo1) >> (8-m);        ytmp[0] ^= b32.x4u.lo1*c;          mask <<= 1;      } -    /* divide each result by the generator polynomial */    for(k=0;k<4;k++)      {        maxpower2 = 30-_norm(ytmp[k]);   -      while(maxpower2 >= m) +      while(maxpower2 >= 8)      { -      c = poly << (maxpower2 - m); +      c = poly << (maxpower2 - 8);        ytmp[k] ^= c;        maxpower2 = 30-_norm(ytmp[k]);      } 

cheers,

sam


                       

Viewing all articles
Browse latest Browse all 91752

Trending Articles