Changeset 9e5efff in git


Ignore:
Timestamp:
Apr 5, 2016, 4:50:42 PM (8 years ago)
Author:
Hans Schoenemann <hannes@…>
Branches:
(u'spielwiese', '5b153614cbc72bfa198d75b1e9e33dab2645d9fe')
Children:
281335d5bbcb1497be84e729427cf2f4b494c484
Parents:
562b8aa65c17482d4bc6eb8332aab2af93e3806e
Message:
opt: intvec.h
Location:
libpolys/misc
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • libpolys/misc/intvec.cc

    r562b8aa r9e5efff  
    2424/*0 implementation*/
    2525
    26 // omBin intvec_bin = omGetSpecBin(sizeof(intvec));
    27 #if 0
    28 intvec::intvec(intvec* iv)
    29 {
    30   row = iv->rows();
    31   col = iv->cols();
    32   v   = (int *)omAlloc(sizeof(int)*row*col);
    33   for (int i=0; i<row*col; i++)
    34   {
    35     v[i] = (*iv)[i];
    36   }
    37 }
    38 #endif
     26omBin intvec_bin = omGetSpecBin(sizeof(intvec));
    3927
    4028intvec::intvec(int s, int e)
     
    265253  return 0;
    266254}
    267 
    268 #if 0
    269 intvec * ivCopy(intvec * o)
    270 {
    271   intvec * iv=new intvec(o);
    272   return iv;
    273 }
    274 #endif
    275255
    276256intvec * ivAdd(intvec * a, intvec * b)
  • libpolys/misc/intvec.h

    r562b8aa r9e5efff  
    1212
    1313
    14 //extern omBin intvec_bin;
     14extern omBin intvec_bin;
    1515
    1616class intvec
     
    5252  void resize(int new_length);
    5353  inline int range(int i) const
    54     { return ((i<row) && (i>=0) && (col==1)); }
     54    //{ return ((i<row) && (i>=0) && (col==1)); }
     55    { return ((((unsigned)i)<((unsigned)row)) && (col==1)); }
    5556  inline int range(int i, int j) const
    56     { return ((i<row) && (i>=0) && (j<col) && (j>=0)); }
     57    //{ return ((i<row) && (i>=0) && (j<col) && (j>=0)); }
     58    { return ((((unsigned)i)<((unsigned)row)) && (((unsigned)j)<((unsigned)col))); }
    5759  inline int& operator[](int i)
    5860    {
     
    8789  inline int  cols() const { return col; }
    8890  inline int  rows() const { return row; }
    89   inline void length(int l) { row = l; col = 1; }
    9091  void show(int mat=0,int spaces=0) const;
    9192  #ifndef SING_NDEBUG
     
    122123    return m;
    123124  }
    124 #if 0
    125   // TODO: no omalloc Bin (de-)/allocation?
    126125  void* operator new ( size_t size )
    127126  {
     
    135134    omFreeBin((ADDRESS)block, intvec_bin);
    136135  }
    137 #endif
    138136  // keiner (ausser obachman) darf das folgenden benutzen !!!
    139137  inline int * ivGetVec() { return v; }
     
    143141  if( o != NULL )
    144142    return new intvec(o);
    145 
    146143  return NULL;
    147144}
Note: See TracChangeset for help on using the changeset viewer.