Re: how to optimize a for loop



On Oct 30, 6:14 pm, andreyvul <andrey....@xxxxxxxxx> wrote:
I have this loop (all variables are pointers):
for (foo = bar; foo > baz; foo--)
*(foo+1) = *foo;
How do I optimize the pointer swap so that it uses -- and ++ or unary
+- instead of +1 (if possible - I don't want to have more #defines
than code)?
IOCCC winners can really help me with this :P

memmove(foo+1, foo, len);

Note that memcpy() is not allowed here.

.