linux-mips
[Top] [All Lists]

Re: [PATCH 1/7] AR7: core support

To: Thiemo Seufer <ths@networkno.de>
Subject: Re: [PATCH 1/7] AR7: core support
From: Geert Uytterhoeven <geert@linux-m68k.org>
Date: Mon, 3 Sep 2007 18:06:35 +0200 (CEST)
Cc: Matteo Croce <technoboy85@gmail.com>, linux-mips@linux-mips.org
In-reply-to: <20070903150444.GC29574@networkno.de>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <40101cc30709030623r4fb2d3caw146fa6dec16b283e@mail.gmail.com> <20070903150444.GC29574@networkno.de>
Sender: linux-mips-bounce@linux-mips.org
On Mon, 3 Sep 2007, Thiemo Seufer wrote:
> Matteo Croce wrote:
> > +static int gcd(int x, int y)
> > +{
> > +   if (x > y)
> > +           return (x % y) ? gcd(y, x % y) : y;
> > +   return (y % x) ? gcd(x, y % x) : x;
> > +}

Ugh, recursion...

> > +static inline int ABS(int x)
> > +{
> > +   return (x >= 0) ? x : -x;
> > +}
> 
> Isn't that already available in the generic kernel code?

abs() is in <linux/kernel.h>

gcd() is in net/ipv4/ipvs/ip_vs_wrr.c (case a > b only) and
sound/core/pcm-timer.c (both).

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>