Changeset 48eb34 in git


Ignore:
Timestamp:
Apr 3, 2018, 2:50:32 PM (5 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '8e0ad00ce244dfd0756200662572aef8402f13d5')
Children:
414cce519189e70ffda5ff4b972038335e5df374
Parents:
891f0edafd7f89cbc1574615217411372828de84
git-author:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2018-04-03 14:50:32+02:00
git-committer:
Hans Schoenemann <hannes@mathematik.uni-kl.de>2018-04-03 14:52:50+02:00
Message:
fix: Exp/Log tables for modulo.cc, omtTest-r (debug version), undef. memory
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/modulop.cc

    r891f0e r48eb34  
    4141void    npCoeffWrite  (const coeffs r, BOOLEAN details);
    4242const char *  npRead  (const char *s, number *a,const coeffs r);
     43void nvInpMult(number &a, number b, const coeffs r);
    4344
    4445#ifdef LDEBUG
     
    509510  //r->cfName = ndName;
    510511  //r->cfInpMult=ndInpMult;
     512  r->convSingNFactoryN=npConvSingNFactoryN;
     513  r->convFactoryNSingN=npConvFactoryNSingN;
     514  r->cfRandom=npRandom;
     515#ifdef LDEBUG
     516  // debug stuff
     517  r->cfDBTest=npDBTest;
     518#endif
     519
    511520#ifdef NV_OPS
    512521  if (c>NV_MAX_PRIME)
     
    523532  }
    524533#endif
    525 #ifdef LDEBUG
    526   // debug stuff
    527   r->cfDBTest=npDBTest;
    528 #endif
    529 
    530   r->convSingNFactoryN=npConvSingNFactoryN;
    531   r->convFactoryNSingN=npConvFactoryNSingN;
    532 
    533   r->cfRandom=npRandom;
    534534
    535535  // io via ssi
     
    547547#endif
    548548  {
    549 #if !defined(HAVE_DIV_MOD) || !defined(HAVE_MULT_MOD)
    550     r->npExpTable=(unsigned short *)omAlloc( r->ch*sizeof(unsigned short) );
    551     r->npLogTable=(unsigned short *)omAlloc( r->ch*sizeof(unsigned short) );
     549#ifdef HAVE_DIV_MOD
     550    r->npInvTable=(unsigned short*)omAlloc0( r->ch*sizeof(unsigned short) );
     551#elif !defined(HAVE_MULT_MOD)
     552    r->npExpTable=(unsigned short *)omAlloc0( r->ch*sizeof(unsigned short) );
     553    r->npLogTable=(unsigned short *)omAlloc0( r->ch*sizeof(unsigned short) );
    552554    r->npExpTable[0] = 1;
    553555    r->npLogTable[0] = 0;
     
    578580    }
    579581#endif
    580 #ifdef HAVE_DIV_MOD
    581     r->npInvTable=(unsigned short*)omAlloc0( r->ch*sizeof(unsigned short) );
    582 #endif
    583   }
     582  }
     583#ifdef NV_OPS
     584  else /*if (c>NV_MAX_PRIME)*/
     585  {
     586    r->cfMult  = nvMult;
     587    r->cfDiv   = nvDiv;
     588    r->cfExactDiv = nvDiv;
     589    r->cfInvers  = nvInvers;
     590    r->cfInpMult = nvInpMult;
     591    //r->cfPower= nvPower;
     592    //if (c>FACTORY_MAX_PRIME) // factory will catch this error
     593    //{
     594    //  r->convSingNFactoryN=ndConvSingNFactoryN;
     595    //}
     596  }
     597#endif
    584598  return FALSE;
    585599}
     
    780794}
    781795
    782 void   nvInpMult(number &a, number b, const coeffs r)
     796void nvInpMult(number &a, number b, const coeffs r)
    783797{
    784798  number n=nvMultM(a,b,r);
    785799  a=n;
    786800}
    787 
    788801
    789802static inline long nvInvMod(long a, const coeffs R)
  • libpolys/coeffs/modulop.h

    r891f0e r48eb34  
    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  return (number)(long)r->npExpTable[x<=r->npPminus1M ? x : x- r->npPminus1M];
    5959}
    6060static inline void npInpMultM(number &a, number b, const coeffs r)
    6161{
    6262  long x = (long)r->npLogTable[(long)a]+ r->npLogTable[(long)b];
    63   a=(number)(long)r->npExpTable[x<r->npPminus1M ? x : x- r->npPminus1M];
     63  a=(number)(long)r->npExpTable[x<=r->npPminus1M ? x : x- r->npPminus1M];
    6464}
    6565#endif
  • omalloc/omDebugCheck.c

    r891f0e r48eb34  
    410410  om_CallErrorHook = 1;
    411411
    412   if (error!=omError_NotBinAddr)
     412  if ((error!=omError_NotBinAddr)&&(error!=omError_FreedAddr))
    413413    _omPrintAddrInfo(stderr, error, addr, bin_size, flags, 10, " occurred for");
    414414  om_Opts.ErrorHook();
Note: See TracChangeset for help on using the changeset viewer.