Code:
// copy swapped slices back to framebuffer
y = height * pct / 100;
memcpy(pfb + y * width_bytes, psave, (height - y) * width_bytes);
memcpy(pfb, psave + (height - y) * width_bytes, y * width_bytes);
so... we want to do something similar but on the X axis I guess?
So there you go... two lines to figure out what to do with...
EDIT: I already did the work and shoved some cherries on top. look below