memshift: new function. strshift: reimplement with memshift