[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-Id: <E70919C8-1D2B-4F47-8086-C50E6EEC1D91@mac.com>
Date: Fri, 23 Mar 2007 21:17:35 -0400
From: Kyle Moffett <mrmacman_g4@....com>
To: "H. Peter Anvin" <hpa@...or.com>
Cc: Randy Dunlap <randy.dunlap@...cle.com>,
Andrew Morton <akpm@...ux-foundation.org>,
"J.H." <warthog9@...nel.org>,
kernel list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] sysctl: vfs_cache_divisor
On Mar 23, 2007, at 20:45:21, Kyle Moffett wrote:
> On Mar 23, 2007, at 16:59:02, H. Peter Anvin wrote:
>> Randy Dunlap wrote:
>>> That makes a lot of sense to me. It gives us finer-grained
>>> control without having to support fixed-point data. I've been
>>> working on the fixed-point data patch, but I'm going to give this
>>> method some time also, to see how it looks in code (instead of
>>> just thinking about it).
>>
>> Well, to be specific, it actually is the same thing with different
>> syntax (38.55 or 3855/100).
>
> /* On input: reduce num/den but retain old values for display
> purposes */
> gcd = euclid(&inputnum, &inputden);
> num = inputnum/gcd;
> den = inputden/gcd;
Whoops, if I divide inputnum and inputden by gcd I don't need to pass
by reference.
The trivial implementation of euclid (modulo the bogus address-of
operations above) is of course something like this:
unsigned long euclid(unsigned long a, unsigned long b)
{
unsigned long q, r;
if (!a || !b)
return 1;
do {
q = a / b;
r = a % b;
a = b;
b = r;
} while (r);
return a;
}
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists