Hi everyone,
I am writing a program in C and I have a for loop 0 to N where N can take one of 3 values (1000, 2000 and 4000) all via user input. Is there any way to let the compiler know so that it can make some of the loop specific optimisations? Something like
if(1000==N){*some code*}
else if(2000==N){*something else} ...
could work but I am concerned about final code size and branching time. A switch might be faster but there is still a lot of duplicate code. What can I do?
Thanks!