small savings in bytes by manually inlining func
bug fix: flags might be modified by the ISR between the point it is read & written