Optimize a bit by using mempcpy.