Changeset 863333 in git for libpolys


Ignore:
Timestamp:
Jan 15, 2015, 11:45:47 AM (9 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', 'fe61d9c35bf7c61f2b6cbf1b56e25e2f08d536cc')
Children:
777f8bb0bd3e850c5c7084702f167df3c1b53113
Parents:
cee2052c592af6805a2f85edda3e0bd517fb1b69
Message:
fix: nlInit, use 64bit if possible
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libpolys/coeffs/longrat.cc

    rcee2052 r863333  
    8181#endif
    8282
    83 extern number nlOne; // FIXME? TODO? //  move into coeffs?
    84 
    8583nMapFunc nlSetMap(const coeffs src, const coeffs dst);
    8684
     
    9795
    9896// 64 bit version:
    99 //#if SIZEOF_LONG == 8
    100 #if 0
     97#if SIZEOF_LONG == 8
     98//#if 0
    10199#define MAX_NUM_SIZE 60
    102100#define POW_2_28 (1L<<60)
     
    178176
    179177
    180 number nlOne=INT_TO_SR(1);
    181 
    182178#if (__GNU_MP_VERSION*10+__GNU_MP_VERSION_MINOR < 31)
    183179void mpz_mul_si (mpz_ptr r, mpz_srcptr s, long int si)
     
    331327  //}
    332328  if (mpz_size1(a->z)>MP_SMALL) return TRUE;
    333   LONG ui=(int)mpz_get_si(a->z);
     329  LONG ui=(LONG)mpz_get_si(a->z);
    334330  if ((((ui<<3)>>3)==ui)
    335331  && (mpz_cmp_si(a->z,(long)ui)==0))
    336332  {
    337333    Print("!!longrat:im int %d in %s:%d\n",ui,f,l);
    338     f=NULL;
    339334    return FALSE;
    340335  }
     
    392387  if (f.isImm())
    393388  {
    394     const long lz=f.intval();
    395     const int iz=(int)lz;
    396     if ((long)iz==lz)
    397       return nlInit(f.intval(),r);
    398     else
    399       return nlRInit(lz);
    400 //    return nlInit(f.intval(),r);
     389    return nlInit(f.intval(),r);
    401390  }
    402391  else
     
    23672356{
    23682357  number n;
     2358  #if MAX_NUM_SIZE == 60
     2359  if (((i << 3) >> 3) == i) n=INT_TO_SR(i);
     2360  else                      n=nlRInit(i);
     2361  #else
    23692362  LONG ii=(LONG)i;
    2370   if ( ((ii << 3) >> 3) == ii ) n=INT_TO_SR(ii);
    2371   else                          n=nlRInit(ii);
     2363  if ( (((long)ii==i) && ((ii << 3) >> 3) == ii )) n=INT_TO_SR(ii);
     2364  else                                             n=nlRInit(i);
     2365  #endif
    23722366  nlTest(n, r);
    23732367  return n;
Note: See TracChangeset for help on using the changeset viewer.