[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: load average patches for MiNT 1.10 + patches
Hi Juergen,
>michael smith writes:
>> but I don't believe in that sort
>> of ceiling regardless of how it's implemented, and someone is _bound_ to harp
>> on it.)
>
> true. thats also why you should always do timeouts checks like this
>
> unsigned tick = timer counter (like _hz_200) + time to wait;
> for (...)
> if (timer counter - tick > 0) break;
>
>instead of
> ...
> if (timer counter > tick) break;
>
>(and any compiler that `optimizes' the difference away should be shot. :)
I don't quite see the difference between these two checks - they _both_
will come into trouble if `counter + time to wait' exceeds the value range
of `unsigned'!
The only *real* solution I can see is expanding the timer to a `long
long'...
Martin
--
Martin Koehling | mk@anuurn.do.open.de | Martin_Koehling@un.maus.ruhr.de