Had some trouble implementing ptr_offset, getting closer to a real libc qsort implementation.