Add Block::fill
Some checks failed
CMake on multiple platforms / build (Release, cl, cl, windows-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, macos-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, clang, clang++, ubuntu-latest) (push) Has been cancelled
CMake on multiple platforms / build (Release, gcc, g++, ubuntu-latest) (push) Has been cancelled

This commit is contained in:
2026-10-08 23:12:34 -07:00
parent 1153f552d0
commit d040630b1d
2 changed files with 15 additions and 0 deletions

View File

@@ -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();

View File

@@ -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)