Nios/memmove

From ASMBits

nios/fib3Previous

Write a function that copies a block of memory from the source location to the destination location. The source and destination arrays may overlap, and the copy must still work correctly (contrast memmove with nios/memcpy). The source and destination are byte-aligned, and length can be any number of bytes.

You may assume the source and destination arrays do not wrap around the top of memory space (i.e., 0 <= source and source+length <= 4GB).

void memmove (char* destination, char* source, unsigned int length);

Expected solution length: Around 25 lines.

Sample Input

0x9999, 0, 0, 0, 0, 0xaaaa, 1, 2, 3, 4, 0xbbbb
Copy 16 bytes from offset 24 to offset 4 

Sample Output

0x9999, 1, 2, 3, 4, 0xaaaa, 1, 2, 3, 4, 0xbbbb

Write your solution here

Upload a source file...