Optimized marshal function

Instead of doing bytestodrop O(n) shifts of the output vector, do
one O(n) collect-pass.