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

    // by load.cc, memorybridge/buflimits.f

size_t MemoryAccess::bufLimits(size_t offset)
{
    size_t block = offset / d_blockSize;        // block containing offset

    if (block >= d_nBlocks)                     // offset is too large
        return d_nBlocks;

    d_blockBegin = offset / d_blockSize * d_blockSize;  // cpt. the block
    d_blockEnd = d_blockBegin + d_blockSize;            // boundaries

    return block;
}
