lib: Improve the performance of string.c

The performance of memcpy and memmove of the general version is
very inefficient, this patch improves them.

Taken from Arne Coucheron