floot_log2() - two functions with the same name in GCC.

Marcin Dalecki martin@dalecki.de
Sun Jan 22 03:01:00 GMT 2006


Looking at gcc/toplev.h and gcc/toplev.c I have found the following  
two variants of the same
function once in the header and once in the definition fine.

extern inline int
floor_log2 (unsigned HOST_WIDE_INT x)
{
   return x ? HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x) : -1;
}

and again the same function:

int
floor_log2 (unsigned HOST_WIDE_INT x)
{
   int t = 0;

   if (x == 0)
     return -1;

#ifdef CLZ_HWI
   t = HOST_BITS_PER_WIDE_INT - 1 - (int) CLZ_HWI (x);
#else
   ....
#endif

   return t;
}

At first glace it seems that the .c variants represents hand  
optimized C code, which get's never
called. I'm quite convinced that it should be just removed, since  
it's never used
due to overschadowing by the .h variant



More information about the Gcc mailing list