Restore memset and fix memmove

Your revert memmove my implementation commit also removed memset so I added the old code back in. This commit fixes the comparisons and also address compiler warnings.