NXC: inline or safecall for frequently used Btn functions?
Posted: 19 Feb 2011, 17:11
hi,
I'm not sure about using inline or safecall for the following frequently used io functions (used also by different tasks) - I'm currently using inline.
Or is neither needed?
What would be better for code performance, executing safety, and compactness?
I'm not sure about using inline or safecall for the following frequently used io functions (used also by different tasks) - I'm currently using inline.
Or is neither needed?
What would be better for code performance, executing safety, and compactness?
Code: Select all
inline bool btnhit(){
return ( ButtonPressed(BTN1, false) || ButtonPressed(BTN2, false)
|| ButtonPressed(BTN3, false) || ButtonPressed(BTN4, false));
}
Code: Select all
inline int cin() {
int result = -1;
if (ButtonPressed(BTN1, false))
result = BTN1;
else if (ButtonPressed(BTN2, false))
result = BTN2;
else if (ButtonPressed(BTN3, false))
result = BTN3;
else if (ButtonPressed(BTN4, false))
result = BTN4;
return result;
}