code style + speed


Another in my questions about c minutia... ;)

In the function below would it be faster (if less easy to read - always the trade off) to do it inline like this:

maxSingle(( num % 6) + 1, ledColLookup[(num % 8)]);

rather than using the local vars to hold the calculations.



void setSingleLed(int num){
  int row =( num % 6) + 1;
  int col = (num % 8);
  maxSingle(row,  ledColLookup[col]); 

Hi Roy, I would expect the compiler optimizer to eliminate the local variables so both versions should run at the same speed. I haven't checked this myself so could be wrong.