Moving Log2() into compiler.h -- questions
Matt Turner
mattst88 at gmail.com
Sat Feb 14 18:19:11 PST 2009
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?
I think a massive cleanup of compiler.h should be on the TODO list.
Matt Turner
More information about the xorg-devel
mailing list