Changeset 601105 in git for libpolys/coeffs/modulop.cc


Ignore:
Timestamp:
Nov 19, 2013, 6:39:47 PM (10 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
448b6571955b81192b53dc7300bb54a1984142e3
Parents:
9d864add8f262ed66a3af97f514c37d01844334c
Message:
chg: use syzComp in initenterstrongPairs
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/modulop.cc

    r9d864a r601105  
    3535{
    3636  assume( getCoeffType(r) == ID );
    37  
     37
    3838#if SIZEOF_LONG == 4
    3939#define ULONG64 (unsigned long long)(unsigned long)
     
    4141#define ULONG64 (unsigned long)
    4242#endif
    43   return (number) 
     43  return (number)
    4444      (unsigned long)((ULONG64 a)*(ULONG64 b) % (ULONG64 r->ch));
    4545}
     
    5656{
    5757  assume( n_Test(k, r) );
    58  
     58
    5959  int h = (int)((long) k);
    6060  return ((int)h !=0) && (h <= (r->ch>>1));
     
    7878  number c = npMultM(a,b, r);
    7979  assume( n_Test(c, r) );
    80   return c; 
     80  return c;
    8181}
    8282
     
    9292  assume( n_Test(c, r) );
    9393  return c;
    94  
     94
    9595}
    9696
     
    102102{
    103103  assume( n_Test(n, r) );
    104  
     104
    105105  if ((long)n > (((long)r->ch) >>1)) return (int)((long)n -((long)r->ch));
    106106  else                               return (int)((long)n);
     
    111111  assume( n_Test(a, r) );
    112112  assume( n_Test(b, r) );
    113  
     113
    114114  number c = npAddM(a,b, r);
    115115
    116116  assume( n_Test(c, r) );
    117  
     117
    118118  return c;
    119119}
     
    123123  assume( n_Test(a, r) );
    124124  assume( n_Test(b, r) );
    125  
     125
    126126  number c = npSubM(a,b,r);
    127127
     
    134134{
    135135  assume( n_Test(a, r) );
    136  
     136
    137137  return 0 == (long)a;
    138138}
     
    141141{
    142142  assume( n_Test(a, r) );
    143  
     143
    144144  return 1 == (long)a;
    145145}
     
    148148{
    149149  assume( n_Test(a, r) );
    150  
     150
    151151  return ((r->npPminus1M == (long)a)&&((long)1!=(long)a));
    152152}
     
    231231    return (number)0;
    232232  number d;
    233  
     233
    234234#ifndef HAVE_DIV_MOD
    235235  if ((long)b==0)
     
    238238    return (number)0;
    239239  }
    240  
     240
    241241  int s = r->npLogTable[(long)a] - r->npLogTable[(long)b];
    242242  if (s < 0)
     
    250250  assume( n_Test(d, r) );
    251251  return d;
    252  
     252
    253253}
    254254number  npInvers (number c, const coeffs r)
    255255{
    256256  assume( n_Test(c, r) );
    257  
     257
    258258  if ((long)c==0)
    259259  {
     
    262262  }
    263263  number d = npInversM(c,r);
    264  
     264
    265265  assume( n_Test(d, r) );
    266266  return d;
    267  
     267
    268268}
    269269
     
    271271{
    272272  assume( n_Test(c, r) );
    273  
     273
    274274  if ((long)c==0) return c;
    275275
    276 #if 0 
    277   number d = npNegM(c,r); 
     276#if 0
     277  number d = npNegM(c,r);
    278278  assume( n_Test(d, r) );
    279279  return d;
    280280#else
    281   c = npNegM(c,r); 
     281  c = npNegM(c,r);
    282282  assume( n_Test(c, r) );
    283283  return c;
    284 #endif 
     284#endif
    285285}
    286286
     
    298298  assume( n_Test(a, r) );
    299299  assume( n_Test(b, r) );
    300  
     300
    301301//  return (long)a == (long)b;
    302  
     302
    303303  return npEqualM(a,b,r);
    304304}
     
    307307{
    308308  assume( n_Test(a, r) );
    309  
     309
    310310  if ((long)a>(((long)r->ch) >>1)) StringAppend("-%d",(int)(((long)r->ch)-((long)a)));
    311311  else                             StringAppend("%d",(int)((long)a));
     
    436436
    437437  assume( c > 0 );
    438  
     438
    439439  int i, w;
    440440
     
    507507  r->convFactoryNSingN=npConvFactoryNSingN;
    508508#endif
    509  
     509
    510510  // the variables:
    511511  r->nNULL = (number)0;
     
    539539                               % r->ch);
    540540          r->npLogTable[r->npExpTable[i]] = i;
    541           if /*(i == r->ch - 1 ) ||*/ (/*(*/ r->npExpTable[i] == 1 /*)*/) 
     541          if /*(i == r->ch - 1 ) ||*/ (/*(*/ r->npExpTable[i] == 1 /*)*/)
    542542            break;
    543543        }
     
    757757#else
    758758/// TODO: use "long InvMod(long a, const coeffs R)"?!
    759  
     759
    760760   long  s;
    761761
    762    long  u, u0, u1, u2, q, r; // v0, v1, v2, 
     762   long  u, u0, u1, u2, q, r; // v0, v1, v2,
    763763
    764764   u1=1; // v1=0;
Note: See TracChangeset for help on using the changeset viewer.