|
From: | Bill Auerbach |
Subject: | RE: [lwip-devel] [bug #27445] PCB hangs in Fast Retransmit due to unchanging cwnd |
Date: | Fri, 23 Oct 2009 15:14:28 -0400 |
>I allways cast to signed: > if (( (int16_t)((pcb->cwnd + pcb->mss) - pcb->cwnd) ) >0) { ... } >allways with lots of parentesis just to make sure that no optimyser gets >in the way > >This should allways work without using 32bits un-nessessarily Not generically if 'pcb->cwnd + pcb->mss' overflows the maximum positive value a s16_t can hold. Converting to signed supports half the range of the original expression. Leaving it unsigned would allow it to work if cwnd was 10000 and mss was 50000. But for this expression given, it is the same as this: if ((u16_t)( pcb->mss) > 0) { ... } Bill
[Prev in Thread] | Current Thread | [Next in Thread] |