S
sololoquist
#define COUNT_UP
#include <stdio.h>
#define N 10
int main()
{
int i;
#ifdef COUNT_UP
for (i = 0; i < N; i++)
#else
for (i = N; i > 0; i--)
#endif
printf("hello \n");
}
assuming everything as same except the for loops and if variable i 's
usage has no problem with up or down counting which is faster?
does that depend on
1. incl or decl for a particular machine that too if they exist
2. whether there is usage of assembly stmt loop which counts using ecx
register for counting down even if it is there is it faster
I tried it by calling time() with N 1000 and result favoured UP but
then next time DOWN won.
i couldn't go any further. thanx for your time
#include <stdio.h>
#define N 10
int main()
{
int i;
#ifdef COUNT_UP
for (i = 0; i < N; i++)
#else
for (i = N; i > 0; i--)
#endif
printf("hello \n");
}
assuming everything as same except the for loops and if variable i 's
usage has no problem with up or down counting which is faster?
does that depend on
1. incl or decl for a particular machine that too if they exist
2. whether there is usage of assembly stmt loop which counts using ecx
register for counting down even if it is there is it faster
I tried it by calling time() with N 1000 and result favoured UP but
then next time DOWN won.
i couldn't go any further. thanx for your time