Forum Discussion
Altera_Forum
Honored Contributor
11 years agoNIOS-II C Code optimization
I have defined a code looks like below: Style 1: function() { variable declaration and initialization int N; N= read_iteration(); for (n=0; n< N; n++) { i...
Altera_Forum
Honored Contributor
11 years ago --- Quote Start --- Extra code is needed to jump over the else code that is present only in style 2. Branches can take significant time in some architectures. If you don't do much in the body of the if, it can b take as long as simple code like "count++" or similar. If you throw in broken pipeline caused by the extra branch, then yes it sounds reasonable. --- Quote End --- I agree. Thanks for the valuable suggestion. I don't think this could be optimized. However, if you think I am wrong, please suggest.