On Thu, Aug 3, 2017 at 11:40 PM, Colin Percival <cperc...@tarsnap.com> wrote: > On 08/03/17 23:28, Hans Petter Selasky wrote: >> On 08/03/17 16:37, Conrad Meyer wrote: >>> Is it not important that the subtraction and result are evaluated >>> without truncation? >> >> ticks is a circular counter. Assuming time = 0 and jiffies = -1U, then >> "delay" >> becomes a very large negative value, because long is used, and the delay <= 0 >> check, is no longer working like expected. >> >> Casting to "int" or truncating is the right thing to do in this case. > > Signed integer overflow is undefined. Using 'int' is liable to cause problems > after 2^32 ticks.
It is undefined in C, but defined in practice with -fwrapv, which the kernel relies upon already. Best, Conrad _______________________________________________ svn-src-all@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-all To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"