Commit 6bcd067f authored by Adam Wujek's avatar Adam Wujek 💬

proto-ext-whiterabbit: fix calculations for negative alpha

Add casting for delay_ms_fix calculations, otherwise
((s->picos_mu - big_delta_fix) * s->fiber_fix_alpha)
is shifted as unsigned.
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent cfed2306
......@@ -364,8 +364,8 @@ int wr_e2e_offset(struct pp_instance *ppi,
s->picos_mu = big_delta_fix;
}
delay_ms_fix = (((s->picos_mu - big_delta_fix)
* s->fiber_fix_alpha) >> FIX_ALPHA_FRACBITS)
delay_ms_fix = (((int64_t)(s->picos_mu - big_delta_fix)
* (int64_t)s->fiber_fix_alpha) >> FIX_ALPHA_FRACBITS)
+ ((s->picos_mu - big_delta_fix) >> 1)
+ s->delta_tx_m + s->delta_rx_s;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment