in reply to Re: [OT] Swapping buffers in place.
in thread [OT] Swapping buffers in place.
No. This is to deal with the edge case where the last buffer is partial. Think:end-of-file. "swapping pointers" would not achieve the same result.
After the swap, the left (full-sized) buffer will contain the contents of the right buffer, made up the full buffer size, with the left-hand end of the left buffer.
And the right buffer contains the right-hand end the left buffer.
The buffers are mem-mapped chunks of a disk file. You can't swap chunks of disk around by swapping pointers.
|
---|