Commit 8cead1c6 authored by Adam Wujek's avatar Adam Wujek 💬

proto-ext-whiterabbit/wr-servo: fix the overflow of casted picos_mu

For long liks (like 180km) "(signed)s->picos_mu" overflows causing wrong
result of the comparison:
(signed)s->picos_mu < (signed)big_delta_fix)
Signed-off-by: Adam Wujek's avatarAdam Wujek <adam.wujek@cern.ch>
parent 04626f4a
......@@ -276,7 +276,7 @@ int wr_servo_update(struct pp_instance *ppi)
big_delta_fix = s->delta_tx_m + s->delta_tx_s
+ s->delta_rx_m + s->delta_rx_s;
if ((signed)s->picos_mu < (signed)big_delta_fix) {
if ((int64_t)s->picos_mu < (int64_t)big_delta_fix) {
/* avoid negatives in calculations */
s->picos_mu = big_delta_fix;
}
......
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