I need a suggestion on on how do I copy a block of memory efficiently, in single attempt if possible, in C++ or assembly language.
I have a pointer to memory location and offset. Think of a memory as a 2D array that I need to copy consisting of rows and columns.
void* memcpy( void* dest, const void* src, std::size_t count ); Copies count bytes from the object pointed to by src to the object pointed to by dest . Both objects are reinterpreted as arrays of unsigned char. If the objects overlap, the behavior is undefined.
memcpy() function is an inbuilt function in C++ STL, which is defined in <cstring> header file. memcpy() function is used to copy blocks of memory. This function is used to copy the number of values from one memory location to another. The result of the function is a binary copy of the data.
Description. The memmove() function copies count bytes of src to dest. This function allows copying between objects that might overlap as if src is first copied into a temporary array.
Description: A copy from the storage specified by source string to the storage specified by target string is performed.
How about std::memcpy
?
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With