[resolved][puzzle] substitute
kuroneko
Posts: 3,623
Not much of a challenge I admit. But it's SPIN-only so maybe not too scary. Anyway, longfill is on holiday and longmove has to fill in. What would a replacement function look like? Just complete the template function and if it's not too much trouble attach it as SPIN source rather than a [noparse]
See postings #14 and #15 for possible solutions (which I had in in mind that is).
[/noparse] block.
PRI longfill_using_longmove(StartAddress, Value, Count) if Count ' longfill replacement code
See postings #14 and #15 for possible solutions (which I had in in mind that is).
Comments
I believe that Spin is smarter than that. IIRC, it always selects a move order to avoid stepping on its own toes -- assuming that's what you had in mind.
-Phil
-Phil
Having been playing with Fast Fourier Transform recently the answer is obvious, divide and conquer and do it recursively. Full solution in a test harness attached.
Edit: Oops...Had a bug in my first line,
OK, just checked your code and there it reads "1".
"Wasted time" Who said anything about efficiency?
Fair enough, given that this is only a theoretical exercise
FWIW, trigger for this challenge was a (now void) requirement to copy a block of memory from DAT to VAR without having overlap protection kick in (i.e. I wanted the first long transferred first).
Edit: Fixed Baggers zero length Bug.
Not more serious than heaters code, but much more efficient...
and with testcode that shows that it works!
Andy
Honestly, who would be so daft as to want to fill a zero length buffer....
Andy
+10 (that's similar to what I used)