reapply Sanjiv's patch to genericize memcpy/memset/memmove to take an