All of these are solved by using SvPVbyte instead of SvPVX.
In reply to Re^2: Interleaving bytes in a string quickly by ikegami in thread Interleaving bytes in a string quickly by BrowserUk