laziness, impatience, and hubris | |
PerlMonks |
Re: [OT] Swapping buffers in place.by roboticus (Chancellor) |
on Mar 01, 2015 at 19:10 UTC ( [id://1118303]=note: print w/replies, xml ) | Need Help?? |
Here's what I came up with:
The two tricks are: (1) You never have to subtract from your pointers, and (2) you have to detect loops when your pointers have a smaller loop size than the buffer size. Update: It took me a bit of time to get back to this, and I posted it before reviewing the thread. It turns out that graf already described the algorithm, as did hdb. ...roboticus When your only tool is a hammer, all problems look like your thumb.
In Section
Seekers of Perl Wisdom
|
|