Skip to content

Commit

Permalink
Update mem-req.hpp with reset()
Browse files Browse the repository at this point in the history
  • Loading branch information
ManifoldFR committed Oct 18, 2024
1 parent 76d6afc commit 0168977
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions gar/include/aligator/gar/mem-req.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,15 @@ struct MemReq {

void *allocate() const;

/// Advance the pointer to the memory buffer to the next chunk.
template <typename T> void advance(T *&memory) {
assert(_cursor != _chunkSizes.size() && "Reached end of the chunks.");
memory += _chunkSizes[_cursor++] / sizeof(T);
}

/// Reset the cursor for the advance() method.
void reset() { _cursor = 0; }

uint totalBytes() const { return _totalBytes; }

private:
Expand Down

0 comments on commit 0168977

Please sign in to comment.