There was a typo that messed me up for a bit,

Sorry! But they aren't easy to construct. (What I need is a program .... :)

and you solved this one "backwards"

Yes. I eventually noticed that I'd switched horses mid way. I went back and re-did them all consistently. I'm not sure if one way is easier or better than the other; and if it is, if I've chosen the right way. But anyhoo, here are the (now) 4 cases I think are significant; all done the same way.

The first two are nicely consistent in that the shorter elements move in left-to-right order; albeit that in the first they always go through the temp reg, and the second, only the first one does so.

The other two are neither consistent with the first two; nor each other :(

There are definitely two nested loops; the shorter is the outer, the longer the inner. And graff is definitely right that molulo (p1 % p2len) arithmetic is key.

But the decision about when to fetch the temp register; or move from the shorter buffer (and which one) is eluding me for the moment.

even(6)/odd(3) odd(9)/even(4) + Even(10)/even(4) Odd(11)/Odd(3) p2+p2len -3-2-1 p2+p2len -4-3-2-1 + p2+p2len -4-3-2-1 p2+p2len + -4-3-2-1 p2 +0+1+2 p2 +0+1+2+3 + p2 +0+1+2+3 p2 + +0+1+2+3 p1+p1len-6-5-4-3-2-1 p1+p1len-9-8-7-6-5-4-3-2-1 + p1+p1len-0-9-8-7-6-5-4-3-2-1 p1+p1len-9-8-7-6 +-5-4-3-2-1 p1 +0+1+2+3+4+5 p1 +0+1+2+3+4+5+6+7+8 + p1 +0+1+2+3+4+5+6+7+8 p1 +0+1+2+3 ++4+5+6+7+8 0 1 2 3 4 5 6 7 8 0 1 2 3 4 5 6 7 8 + 0 1 2 3 4 5 6 7 8 0 1 2 3 + 4 5 6 7 8 [a b c d e f 1 2 3] temp [a b c d e f g h i 1 2 3 4 +] temp [a b c d e f g h i j 1 2 3 4] temp [a b c d + e f g h i j k 1 2 3] temp [1]>>>>>>[1] [1]>>>>> +>>>[1] [1]>>>>>>>[1] + [1]>>>>>>[1] [d]>>>[d] [f]>>>>>[f] + [g]>>>>>[g] + [i]>>>[i] [a]>>>[a] [b]>>>>>[b] + [c]>>>>>[c] + [f]>>>[f] [1]<<<<<<<<<<<<<<<<<<[1] [2]<<<<<<<<<<<<<<<[2] + [3]<<<<<<<<<<<<<<<<<[3] [c]> +>>[c] [2]>>>>[2] [g]>>>>>[g] + [i]>>>>>[i] [2]< +<<<<<<<<<<<<<<<<[2] [e]>>>[e] [c]>>>>>[c] + [e]>>>>>[e] + [j]>>>[j] [b]>>>[b] [3]<<<<<<<<<<<<<<<[3] + [a]>>>>>[a] + [g]>>>[g] [2]<<<<<<<<<<<<<<<<[2] [h]>>>>>[h] + [1]<<<<<<<<<<<<<<<<<<<<<<<<<<<[1] [d +]>>>[d] [3]>>[3] [d]>>>>>[d] + [2]>>>>>[2] [a]>>>[a +] [f]>>>[f] [4]<<<<<<<<<<<<<<<[4 +] [h]>>>>>[h] [1]<<<<< +<<<<<<<<<<<<<<<<<<<<<<<[1] [c]>>>[c] [i]>>>>>[i +] [d]>>>>>[d] + [3]>>[3] [3]<<<<<<<<<<<<<<[3] [e]>>>>>[e] + [4]<<<<<<<<<<<<<<<<<[4] + [k]>>>[k] [1 2 3 a b c d e f] [a]>>>>>[a] + [j]>>>>>[j] + [h]>>>[h] [1]<<<<<<<<<<<<<<<<<<<<<<< +<<<[1] [f]>>>>>[f] +[e]>>>[e] [1 2 3 4 a b c d e f g h i +] [b]>>>>>[b] [b]>>> +[b] + [2]<<<<<<<<<<<<<<<<<<<<<<<<<[2] [3]<<< +<<<<<<<<<<<<<<<<<<<<<<<[3] + [1 2 3 4 a b c d e f g h i j] [1 2 3 a + b c d e f g h i j k]

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

In reply to Re^3: [OT] Swapping buffers in place. (partial solution:needs more help!) by BrowserUk
in thread [OT] Swapping buffers in place. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.