Ignore:
Timestamp:
05/29/13 11:59:19 (11 years ago)
Author:
tbretz
Message:
Added new member in Column to store the total number of bytes; replaced num*size by bytes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Mars/mcore/fits.h

    r16415 r16424  
    113113            size_t num;
    114114            size_t size;
     115            size_t bytes;  // num*size
    115116            char   type;
    116117            string unit;
     
    346347                }
    347348
    348                 const Table::Column col = { bytes, n, size, type, unit, compress};
     349                const Table::Column col = { bytes, n, size, n*size, type, unit, compress};
    349350
    350351                cols[id] = col;
     
    781782
    782783    template<size_t N>
    783         void revcpy(char *dest, const char *src, int num)
     784        void revcpy(char *dest, const char *src, const int &num)
    784785    {
    785786        const char *pend = src + num*N;
     
    788789    }
    789790
    790     virtual void MoveColumnDataToUserSpace(char* dest, const char*src, const Table::Column& c)
     791    virtual void MoveColumnDataToUserSpace(char *dest, const char *src, const Table::Column& c)
    791792    {
    792793        // Let the compiler do some optimization by
     
    794795        switch (c.size)
    795796        {
    796         case 1: memcpy   (dest, src, c.num*c.size); break;
    797         case 2: revcpy<2>(dest, src, c.num);        break;
    798         case 4: revcpy<4>(dest, src, c.num);        break;
    799         case 8: revcpy<8>(dest, src, c.num);        break;
     797        case 1: memcpy   (dest, src, c.bytes); break;
     798        case 2: revcpy<2>(dest, src, c.num);   break;
     799        case 4: revcpy<4>(dest, src, c.num);   break;
     800        case 8: revcpy<8>(dest, src, c.num);   break;
    800801        }
    801802    }
     
    873874            return it->second;
    874875
    875         fGarbage.emplace_back(fTable.cols[name].size*fTable.cols[name].num);
     876        fGarbage.emplace_back(fTable.cols[name].bytes);
    876877
    877878        void *ptr = fGarbage.back().data();
Note: See TracChangeset for help on using the changeset viewer.