uint QFragmentMapData::findNode(int k) const { uint x = root(); uint s = k; while (x) { if (sizeLeft(x) <= s) { if (s < sizeLeft(x) + size(x)) return x; s -= sizeLeft(x) + size(x); x = X.right; } else { x = X.left; } } return 0; }
int QFragmentMapData::length() const { uint root = this->root(); return root ? sizeLeft(root) + size(root) + sizeRight(root) : 0; }
void MemReader::peek(void* dest, std::size_t size, std::size_t offset) const { BMCL_ASSERT(sizeLeft() >= (size + offset)); std::memcpy(dest, _current + offset, size); }
void MemReader::readImpl(void* dest, std::size_t size) { BMCL_ASSERT(sizeLeft() >= size); std::memcpy(dest, _current, size); _current += size; }
void MemReader::skipImpl(std::size_t size) { BMCL_ASSERT(sizeLeft() >= size); _current += size; }