Lines Matching defs:chunk
569 MemchunkBuffer(Pool<Memchunk> *pool) : pool(pool), chunk(nullptr) {}
572 : pool(other.pool), chunk(other.chunk) {
573 other.chunk = nullptr;
582 chunk = other.chunk;
584 other.chunk = nullptr;
590 if (!pool || !chunk) {
593 pool->recycle(chunk);
598 if (chunk) {
601 chunk = pool->get();
606 if (!chunk) {
609 pool->recycle(chunk);
610 chunk = nullptr;
614 bool chunk_avail() const { return chunk != nullptr; }
620 // Since we has chunk as a member variable, pos and last are
623 uint8_t *pos() const { return chunk->pos; }
624 uint8_t *last() const { return chunk->last; }
626 size_t rleft() const { return chunk->len(); }
627 size_t wleft() const { return chunk->left(); }
631 chunk->last = std::copy_n(p, count, chunk->last);
636 chunk->last += count;
641 chunk->pos += count;
646 std::copy(chunk->pos + count, chunk->last, std::begin(chunk->buf));
647 chunk->last = std::begin(chunk->buf) + (chunk->last - (chunk->pos + count));
648 chunk->pos = std::begin(chunk->buf);
651 void reset() { chunk->reset(); }
652 uint8_t *begin() { return std::begin(chunk->buf); }
653 uint8_t &operator[](size_t n) { return chunk->buf[n]; }
654 const uint8_t &operator[](size_t n) const { return chunk->buf[n]; }
657 Memchunk *chunk;