Re: patch for wanna-build (sysinfo/getloadavg)
Robert Millan <zeratul2@wanadoo.es> writes:
> 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?
I've been away at the UKUUG Linux Conference, and only just returned.
I'll look at it tomorow, I promise ;-)
--
Roger Leigh
Printing on GNU/Linux? http://gimp-print.sourceforge.net/
GPG Public Key: 0x25BFB848 available on public keyservers
Reply to: