linux-mips
[Top] [All Lists]

Re: [PATCH 1/9] kernel: export sound/core/pcm_timer.c gcd implementatio

To: Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 1/9] kernel: export sound/core/pcm_timer.c gcd implementation
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Tue, 2 Jun 2009 09:15:29 +0200
Cc: Florian Fainelli <florian@openwrt.org>, linux-kernel@vger.kernel.org, Takashi Iwai <tiwai@suse.de>, linux-mips@linux-mips.org, Ralf Baechle <ralf@linux-mips.org>, Ingo Molnar <mingo@elte.hu>
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:sender:received:in-reply-to :references:date:x-google-sender-auth:message-id:subject:from:to:cc :content-type:content-transfer-encoding; bh=1fL9dsrN1EreTbxOEv2jWBhBfLcB8qCh89f/ylabOik=; b=FsEn4F4ANnRAf2oOPeAcMgJdk2YmtQBzpii7eLIwF1anJebu7V3zVu8SUoS7DliBmG 3S8rH8oN+MX4EnN24C5N6oTwylpMHqyCGrTeWEwaKCAu+6gd4JIIWe1lp93M5WNiMYuJ 5OyOGf7uxSA/1EW0mL0dOt/vRhcoVLP6vtgg0=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; b=sDCsbwn4Kph6h1apaJwAfXzH+zuAhvLhwFNxIcL6O6kPdBlX/pnWnVyV1PH2mHpvPT NFRUC9U8Zp00qE2Qgw4Fa2tzoLsElLS4XHAcXIkkFmwlUeyuZpj57aOQleplnk9Y2i6Y EPOC8GtOFq/CWr1cPdKe2YbXaNN7xtOZgEozM=
In-reply-to: <20090601215034.7352ddca.akpm@linux-foundation.org>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <200906011357.09966.florian@openwrt.org> <20090601215034.7352ddca.akpm@linux-foundation.org>
Sender: linux-mips-bounce@linux-mips.org
On Tue, Jun 2, 2009 at 06:50, Andrew Morton <akpm@linux-foundation.org> wrote:
> On Mon, 1 Jun 2009 13:57:09 +0200 Florian Fainelli <florian@openwrt.org> 
> wrote:
>
>> This patch exports the gcd implementation from
>> sound/core/pcm_timer.c into include/linux/kernel.h.
>> AR7 uses it in its clock routines.
>>
>> ...
>>
>> diff --git a/include/linux/kernel.h b/include/linux/kernel.h
>> index 883cd44..878a27a 100644
>> --- a/include/linux/kernel.h
>> +++ b/include/linux/kernel.h
>> @@ -147,6 +147,22 @@ extern int _cond_resched(void);
>>               (__x < 0) ? -__x : __x;         \
>>       })
>>
>> +/* Greatest common divisor */
>> +static inline unsigned long gcd(unsigned long a, unsigned long b)
>> +{
>> +        unsigned long r;
>> +        if (a < b) {
>> +                r = a;
>> +                a = b;
>> +                b = r;
>> +        }
>> +        while ((r = a % b) != 0) {
>> +                a = b;
>> +                b = r;
>> +        }
>> +        return b;
>> +}
>
> a) the name's a bit sucky.   Is there some convention for this name?

Well, `gcd' is a quite common acronym, probably almost as well known as `min'
and `max'...

Gr{oetje,eeting}s,

                                                Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                                            -- Linus Torvalds

<Prev in Thread] Current Thread [Next in Thread>