#42617 - LOst? - Fri May 13, 2005 4:19 pm
I have a problem. I need to have a cupple of functions that call other functions and do some math during a loop but looks almost the same. I can't do a loop alone and then a function pointer inside the loop because the loop is critical and needs to be fast. Here is an example of my loop:
Since I'm using C, I tried to do a #define macro but it couldn't call fast_asm_function() from the macro, and it couldn't even do count++.
I know this is hard to understand. After all I can copy the code myself to multiple functions that almost work the same except for the math part, but I am afraid I will forget something after I am up to over 20 copies (brain will overflow) *dies*.
Remember that __inline functions are C++, and I can't use C++. I'm using C all the way for speed.
Code: |
for ( ; count < 224; ) { fast_asm_function (); // Always call this in the beginning of the loop count++; // Needs to increase the counter before doing the math // math goes here // This is the place where I want to change my code // but I can't let it call a function 224 times // because it is too slow } |
Since I'm using C, I tried to do a #define macro but it couldn't call fast_asm_function() from the macro, and it couldn't even do count++.
I know this is hard to understand. After all I can copy the code myself to multiple functions that almost work the same except for the math part, but I am afraid I will forget something after I am up to over 20 copies (brain will overflow) *dies*.
Remember that __inline functions are C++, and I can't use C++. I'm using C all the way for speed.