Changeset eb059c5 in git for kernel/longrat.cc


Ignore:
Timestamp:
Aug 4, 2004, 3:21:55 PM (20 years ago)
Author:
Hans Schönemann <hannes@…>
Branches:
(u'spielwiese', '17f1d200f27c5bd38f5dfc6e8a0879242279d1d8')
Children:
fd1978167b53af9ab851cd4eb86936122d35a7d4
Parents:
6c90074698fffbdf3734e19fde2653870561607e
Message:
*hannes: minor optimization (less realloc in nlNormalize)


git-svn-id: file:///usr/local/Singular/svn/trunk@7309 2c84dea3-7e68-4137-9b89-c4e89433aadc
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/longrat.cc

    r6c9007 reb059c5  
    22*  Computer Algebra System SINGULAR     *
    33****************************************/
    4 /* $Id: longrat.cc,v 1.2 2004-06-04 13:23:10 Singular Exp $ */
     4/* $Id: longrat.cc,v 1.3 2004-08-04 13:21:55 Singular Exp $ */
    55/*
    66* ABSTRACT: computation with long rational numbers (Hubert Grassmann)
     
    9797omBin rnumber_bin = omGetSpecBin(sizeof(snumber));
    9898
    99 number nlOne=nlInit(1);
     99number nlOne=INT_TO_SR(1);
    100100
    101101#if (__GNU_MP_VERSION*10+__GNU_MP_VERSION_MINOR < 31)
     
    229229{
    230230  double f=nrFloat(from);
    231   if (f==0.0) return nlInit(0);
     231  if (f==0.0) return INT_TO_SR(0);
    232232  int f_sign=1;
    233233  if (f<0.0)
     
    265265  size = (*f)[0]._mp_size;
    266266  if (size == 0)
    267     return nlInit(0);
     267    return INT_TO_SR(0);
    268268  if(size<0)
    269269  {
     
    11451145    {
    11461146      nlDelete(&x,currRing);
    1147       x=nlInit(0);
     1147      x=INT_TO_SR(0);
    11481148      return;
    11491149    }
     
    12021202    else if (divided)
    12031203    {
    1204       _mpz_realloc(&x->n,mpz_size1(&x->n));
    1205     }
    1206     if (divided) _mpz_realloc(&x->z,mpz_size1(&x->z));
     1204#define mpz_alloc1(A) ((A)->_mp_alloc)
     1205      int l;
     1206      if ((mpz_alloc1(&x->n)>>1) >= (l=mpz_size1(&x->n)))
     1207      {
     1208        _mpz_realloc(&x->n,il /* mpz_size1(&x->n)*/);
     1209      }
     1210    }
     1211    if (divided)i
     1212    {
     1213      int l;
     1214      if ((mpz_alloc1(&x->z)>>1) >= (l=mpz_size1(&x->z)))
     1215      {
     1216        _mpz_realloc(&x->z,l /*mpz_size1(&x->z)*/);
     1217      }
     1218    }
    12071219  }
    12081220#ifdef LDEBUG
Note: See TracChangeset for help on using the changeset viewer.