It's called a Duff device, see Wikipedia .
If you want to implement / use a quick copy, first look at the implementation of your compiler; it can use a much more complex algorithm, using the advanced features of your processor. For example, Intel compilers have rather complex versions.
source
share