[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: load average patches for MiNT 1.10 + patches



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? :)

> The only *real* solution I can see is expanding the timer to a `long
> long'...

 only if the timeout is longer than 2^31 ticks.
> 
> Martin
 cheers
	Juergen
-- 
J"urgen Lock / nox@jelal.north.de / UUCP: ..!uunet!unido!uniol!jelal!nox
								...ohne Gewehr
PGP public key fingerprint =  8A 18 58 54 03 7B FC 12  1F 8B 63 C7 19 27 CF DA