in reply to Re^3: [OT] Swapping buffers in place.
in thread [OT] Swapping buffers in place.

I added back your swap count code and added some to the iterative version, and its easy to see the reason yours is faster:

C:\test\C>bufswap 402653184 268435456 size:402653184 offset;268435456 [ 0 1 2 3 4 5 6 7 8 9 ...268435446 268435 +447 268435448 268435449 268435450 268435451 268435452 268435453 26843 +5454 268435455 268435456 268435457 268435458 268435459 268435460 2684 +35461 268435462 268435463 268435464 268435465 ...402653174 402653175 +402653176 402653177 402653178 402653179 402653180 402653181 402653182 + 402653183 ] [268435456 268435457 268435458 268435459 268435460 268435461 268435462 + 268435463 268435464 268435465 ...134217718 134217719 134217720 13421 +7721 134217722 134217723 134217724 134217725 134217726 134217727 1342 +17728 134217729 134217730 134217731 134217732 134217733 134217734 134 +217735 134217736 134217737 ...268435446 268435447 268435448 268435449 + 268435450 268435451 268435452 268435453 268435454 268435455 ] iterative: swaps:402653184 took 3.218781038 secs. [ 0 1 2 3 4 5 6 7 8 9 ...268435446 268435 +447 268435448 268435449 268435450 268435451 268435452 268435453 26843 +5454 268435455 268435456 268435457 268435458 268435459 268435460 2684 +35461 268435462 268435463 268435464 268435465 ...402653174 402653175 +402653176 402653177 402653178 402653179 402653180 402653181 402653182 + 402653183 ] [268435456 268435457 268435458 268435459 268435460 268435461 268435462 + 268435463 268435464 268435465 ...134217718 134217719 134217720 13421 +7721 134217722 134217723 134217724 134217725 134217726 134217727 1342 +17728 134217729 134217730 134217731 134217732 134217733 134217734 134 +217735 134217736 134217737 ...268435446 268435447 268435448 268435449 + 268435450 268435451 268435452 268435453 268435454 268435455 ] recursive: swaps:268435456 took 2.436202970 secs.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked