Re: how to optimize a for loop
- From: Keith Thompson <kst-u@xxxxxxx>
- Date: Tue, 30 Oct 2007 18:46:48 -0700
andreyvul <andrey.vul@xxxxxxxxx> writes:
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
What makes you think that replacing "+1" with "++" is an optimization?
--
Keith Thompson (The_Other_Keith) kst-u@xxxxxxx <http://www.ghoti.net/~kst>
San Diego Supercomputer Center <*> <http://users.sdsc.edu/~kst>
"We must do something. This is something. Therefore, we must do this."
-- Antony Jay and Jonathan Lynn, "Yes Minister"
.
- Follow-Ups:
- Re: how to optimize a for loop
- From: andreyvul
- Re: how to optimize a for loop
- References:
- how to optimize a for loop
- From: andreyvul
- how to optimize a for loop
- Prev by Date: Re: What's the use of anonymous structs?
- Next by Date: Re: Hello, World!
- Previous by thread: Re: how to optimize a for loop
- Next by thread: Re: how to optimize a for loop
- Index(es):