Re: [PATCH] cb_pcimdda.c inlining problems

Ian Abbott wrote:
> Hi,
> 
> My compiler (gcc 3.4.3) failed to compile cb_pcimdda.c because it
> couldn't find the body of an inline function.  The attached patch fixes
> the problem by replacing the forward declaration of the function with
> the function definition.

Incidentally, that inline function I moved looks a little inefficient:

static inline lsampl_t figure_out_maxdata(int bits)
{
     lsampl_t max = 0;
     int i;

     for (i = 0; i < bits; i++) {
       max <<= 1;
       max |=  1U;
     }
     return max;
}

Here's a faster version:

static inline lsampl_t figure_out_maxdata(int bits)
{
	return (((lsampl_t)1 << bits) - 1);
}

I've amended my previous patch to include the faster version.

Received on 2005-01-12Z17:36:12