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]
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
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |