[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: load average patches for MiNT 1.10 + patches
Hi Juergen,
>Martin Koehling writes:
>> Hi Juergen,
>moin
>>
>> >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'!
>
> hmpf i shouldn't post from memory... remove the unsigned, i.e. make
>it a signed comparison. better? :)
Much better - that's quite a neat trick! :)
Martin
--
Martin Koehling | mk@anuurn.do.open.de | Martin_Koehling@un.maus.ruhr.de