diff --git a/include/block.h b/include/block.h index 3c1e817..3008314 100644 --- a/include/block.h +++ b/include/block.h @@ -92,6 +92,9 @@ public: // Copy a range of data to the destination pointer void copy(void* dest, int start, int count); + // Fill an entire block with a byte value + void fill(uint8_t v); + // Lock the memory, forcing it to be loaded into a contiguous block of address space void lock(); diff --git a/src/block.cpp b/src/block.cpp index ce051e4..b3a1cb1 100644 --- a/src/block.cpp +++ b/src/block.cpp @@ -273,6 +273,18 @@ void Block::append(void* data, size_t size) unlock(); } +// Fill an entire block with a byte value +void Block::fill(uint8_t v) +{ + if (getSize() == 0) { + return; + } + + lock(); + memset(getStart(), v, getSize()); + unlock(); +} + // Copy the entire data block to the destination pointer void Block::copy(void* dest)