#define XERR "memoryaccess"
#include "memoryaccess.ih"

    // by memorybridge/truncate.cc

void MemoryAccess::truncate(size_t newSize)
{
    newSize = min(newSize, d_nBlocks * d_blockSize);

    if (newSize < d_writtenUntil)        // set bytes until d_writtenUntil to 0
        setZero(newSize);

    d_writtenUntil = newSize;            // bytes >= writtenUntil are all 0
}


//xerr("size = " << size << ", d_maxSize = " << d_maxSize);
//xerr("d_offset: " << d_offset << ", max readable: " << d_maxSize);
//    {
//        size_t count = size - d_maxSize;
//        d_maxSize = size;
//        setZero(count);
//    }



