int32 nominator
bool32 gate
int32 denom1
int32 denom2
int gate;
int prev;
int r;
if (inlet_a >= 0)
r = ((unsigned int)inlet_a) / param_denom1;
else
r = -(((unsigned int)(param_denom1 - inlet_a)) / param_denom1);
int s = r;
if (inlet_a >= 0)
r = ((unsigned int)inlet_a) / param_denom2;
else
r = -(((unsigned int)(param_denom2 - inlet_a)) / param_denom2);
if (!(prev == s + r)) {
gate = (gate + 1) & 1;
}
prev = s + r;
outlet_gate = gate;