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 Nov 15, 2024
1 parent 752a385 commit d8970b1
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 d8970b1

Please sign in to comment.