should_yield problem [Was: svn commit: r251322 - head/sys/kern]
Andriy Gapon
avg at FreeBSD.org
Wed Jul 3 08:24:36 UTC 2013
on 03/07/2013 07:40 Bruce Evans said the following:
> On Tue, 2 Jul 2013, Andriy Gapon wrote:
>> distance = (signed)( i1 - i2 )
>
> With 2's complement and benign overflow, this is no different from
> 'distance = i1 - i2'.
Given the particular context I'd say that there is a difference.
> But signed counters are not wanted here. A
> negative distance, or equivalently with 32-bit unsigned ints, an unsigned
> difference of >= 0x80000000 means overflow or an initialization error.
> Your bug is an initialization error.
Right. But I'd rather produce a positive (unsigned) number than a negative
number when such an error happens (and is detectable). Again, I am speaking
about the concrete context.
--
Andriy Gapon
More information about the svn-src-head
mailing list