lib: improve the performance of memcpy and memmove of the general version

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

Change-Id: I158fb8b4c795aec03994dfac271a2e5c14aeaea7
Signed-off-by: Miao Xie <miaox@cn.fujitsu.com>