use memcpy instead of looping