Re: [PATCH] af_rose.c: s/suser/capable/ + micro cleanups

From: Rogier Wolff (R.E.Wolff@BitWizard.nl)
Date: Wed Aug 30 2000 - 17:26:29 EST


Linus Torvalds wrote:
> actually prefer
>
> if (complex_test)
> return complex_expression1;
>
> return complex_expression2;
>
> over
>
> return (complex_test) ? complex_expression1 : complex_expression2;

Trade offs trade offs...

Compare:

   int mr (unsigned int rate, int r)
   {
     int e = 16+9;
     static int round[4]={0, 0, 0xffff, 0x8000};
     if (!rate) return 0;
     for (; rate & 0xfc000000 ;rate >>= 1, e++);
     for (;!(rate & 0xfe000000);rate <<= 1, e--);
     return ((rate & ~0x02000000) | (e << (16+9)) + round[r]) >> 16;
   }

Dense code, right? Floating point in the kernel.... Aaargh.

Compare that with one hundred and twenty heavily commented lines in
drivers/atm/ambassador.c ..... (A very neat driver, by the way,
although you don't need 120 lines of code to do the above....)

                                Roger.

-- 
** R.E.Wolff@BitWizard.nl ** http://www.BitWizard.nl/ ** +31-15-2137555 **
*-- BitWizard writes Linux device drivers for any device you may have! --*
*       Common sense is the collection of                                *
******  prejudices acquired by age eighteen.   -- Albert Einstein ********
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Thu Aug 31 2000 - 21:00:26 EST