Changeset 55b747 in git for libpolys/coeffs/modulop.h


Ignore:
Timestamp:
Apr 4, 2018, 6:55:03 PM (6 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
15d6bf96cee82d224cc98ac91b2ee533a290e13a
Parents:
d795761c5157c077e2f8451be201ede9fd36fb3f
Message:
opt: Z/p arithm.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/modulop.h

    rd795761 r55b747  
    5656{
    5757  long x = (long)r->npLogTable[(long)a]+ r->npLogTable[(long)b];
    58   return (number)(long)r->npExpTable[x<=r->npPminus1M ? x : x- r->npPminus1M];
     58  #ifdef HAVE_GENERIC_ADD
     59  if (x>r->npPminus1M) x-=r->npPminus1M;
     60  #else
     61    x-=r->npPminus1M;
     62    #if SIZEOF_LONG == 8
     63     x += (x >> 63) & r->npPminus1M;
     64    #else
     65     x += (x >> 31) & r->npPminus1M;
     66    #endif
     67  #endif
     68  return (number)(long)r->npExpTable[x];
    5969}
    6070static inline void npInpMultM(number &a, number b, const coeffs r)
    6171{
    6272  long x = (long)r->npLogTable[(long)a]+ r->npLogTable[(long)b];
    63   a=(number)(long)r->npExpTable[x<=r->npPminus1M ? x : x- r->npPminus1M];
     73  #ifdef HAVE_GENERIC_ADD
     74  if (x>r->npPminus1M) x-=r->npPminus1M;
     75  #else
     76    x-=r->npPminus1M;
     77    #if SIZEOF_LONG == 8
     78     x += (x >> 63) & r->npPminus1M;
     79    #else
     80     x += (x >> 31) & r->npPminus1M;
     81    #endif
     82  #endif
     83  a=(number)(long)r->npExpTable[x];
    6484}
    6585#endif
Note: See TracChangeset for help on using the changeset viewer.