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

Re: patch for wanna-build (sysinfo/getloadavg)



On Sat, Jul 26, 2003 at 06:38:19PM +0000, Robert Millan wrote:
> On Thu, Jul 24, 2003 at 12:14:57AM +0100, Roger Leigh wrote:
> > [...]
> > 
> > This seems rather complex!  Why not just do something like:
> >                 waittime = (long) (loadavg[0] / 16384) * 6 + 20;
> > 
> > If you don't need SI_LOAD_SHIFT (Linux-specific??), it can probably be
> > even simpler.
> 
> Can I cast a double to long like that? What kind of truncating happens if
> loadavg[0] is bigger than LONG_MAX? Does a division with 2^14 garantee it
> will fit nicely?

So? Anyone has comments on this?

-- 
Robert Millan

"[..] but the delight and pride of Aule is in the deed of making, and in the
thing made, and neither in possession nor in his own mastery; wherefore he
gives and hoards not, and is free from care, passing ever on to some new work."

 -- J.R.R.T, Ainulindale (Silmarillion)



Reply to: