Moving Log2() into compiler.h -- questions

Matthieu Herrb matthieu.herrb at laas.fr
Sun Feb 15 09:47:51 PST 2009


Matt Turner wrote:
> Hi,
> 
> I'm going to implement a common Log2 function in the X core. This way,
> it doesn't need to be reimplemented in every DDX and module.
> (xf86-video-ati implements it _twice_!)
> 
> Many platform-specific macros and defines are wrapped in some of the
> most convoluted ifdef/ifndef spaghetti I've ever seen, making finding
> and comparing implementations difficult.
> 
> I therefore propose something like this:
> 
> #if (defined __i386__ || defined __x86_64__) && (defined __GNUC__)
> <x86 implementation>
> #elif defined (__alpha__)
> <alpha implementation>
> #elif defiend (__sparc__)
> <sparc implementation>
> #else
> <generic implementation>
> #endif
> 
> That is to say, keep all the implementations of xf86Log2 in one place
> instead of spread throughout the entire file.
> 
> Is this acceptable?

Yes, probably.
> 
> I think a massive cleanup of compiler.h should be on the TODO list.

Yes, but please touch it with care, and test changes some non Linux/x86
systems before committing.
-- 
Matthieu Herrb


More information about the xorg-devel mailing list