String.h
This commit is contained in:
@@ -27,6 +27,14 @@ void memoryCopy(void *dest, const void *src, const size_t size) {
|
||||
assertNotNull(src, "Cannot copy from NULL memory.");
|
||||
assertTrue(size > 0, "Cannot copy 0 bytes of memory.");
|
||||
assertTrue(dest != src, "Cannot copy memory to itself.");
|
||||
|
||||
// Check for overlapping regions
|
||||
assertTrue(
|
||||
((uint8_t*)dest + size <= (uint8_t*)src) ||
|
||||
((uint8_t*)src + size <= (uint8_t*)dest),
|
||||
"Source and destination memory regions overlap."
|
||||
);
|
||||
|
||||
memcpy(dest, src, size);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user