Revert "Remove non-standard memswap."

This reverts commit 616b47a8db13645a671c6118450ec7817fe72c22.