/* RESET VALUES -- simple macro to reset variable conditionally */ #define RESET(cmp,var,to,fn) do { if(cmp(var)) fn(var); var=to } while(0)