Optimize Critical Section Functions

Andreas Mohr andi at rhlx01.fht-esslingen.de
Fri Aug 20 13:57:05 CDT 2004


Hi,

On Fri, Aug 20, 2004 at 04:50:36PM +0100, Robert Shearman wrote:
> Index: wine/dlls/ntdll/critsection.c
> ===================================================================
> RCS file: /home/wine/wine/dlls/ntdll/critsection.c,v
> retrieving revision 1.26
> diff -u -p -r1.26 critsection.c
> --- wine/dlls/ntdll/critsection.c	17 Jun 2004 23:11:08 -0000	1.26
> +++ wine/dlls/ntdll/critsection.c	20 Aug 2004 15:46:18 -0000
> @@ -36,6 +36,14 @@
>  WINE_DEFAULT_DEBUG_CHANNEL(ntdll);
>  WINE_DECLARE_DEBUG_CHANNEL(relay);
>  
> +#ifdef __GNUC__
> +# define likely(x)   __builtin_expect(!!(x), 1)
> +# define unlikely(x) __builtin_expect(!!(x), 0)
> +#else
> +# define likely(x)   !!(x)
> +# define unlikely(x) !!(x)
> +#endif
> +

Umm, this should go into a global header file, right?
The theory being that it would be useful at many more performance critical
Wine places...

But I have to admit that I don't know which header file this should be...

Andreas Mohr



More information about the wine-devel mailing list