X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fmesa%2Fmain%2Fcompiler.h;h=5557a3b5cb5ac4ffd804bb27d84ee22d389dc6c6;hb=f29606598e7703d830440a878673d98e7ce13218;hp=81704ae2c1166cf1bb913bdd8f61837e0b087b04;hpb=3ca933623cf0fd3b025ab7d1b37d3fd01c854807;p=mesa.git diff --git a/src/mesa/main/compiler.h b/src/mesa/main/compiler.h index 81704ae2c11..5557a3b5cb5 100644 --- a/src/mesa/main/compiler.h +++ b/src/mesa/main/compiler.h @@ -65,9 +65,7 @@ extern "C" { typedef unsigned __int8 uint8_t; typedef __int16 int16_t; typedef unsigned __int16 uint16_t; -# ifndef __eglplatform_h_ - typedef __int32 int32_t; -# endif + typedef __int32 int32_t; typedef unsigned __int32 uint32_t; typedef __int64 int64_t; typedef unsigned __int64 uint64_t; @@ -200,6 +198,13 @@ extern "C" { # define __builtin_expect(x, y) x #endif +#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 /** * The __FUNCTION__ gcc variable is generally only used for debugging. @@ -219,6 +224,18 @@ extern "C" { # endif # endif #endif +#ifndef __func__ +# if (__STDC_VERSION__ >= 199901L) || \ + (defined(__SUNPRO_C) && defined(__C99FEATURES__)) + /* __func__ is part of C99 */ +# elif defined(_MSC_VER) +# if _MSC_VER >= 1300 +# define __func__ __FUNCTION__ +# else +# define __func__ "" +# endif +# endif +#endif /** @@ -311,6 +328,11 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) #endif #endif +#if (__GNUC__ >= 3) +#define PRINTFLIKE(f, a) __attribute__ ((format(__printf__, f, a))) +#else +#define PRINTFLIKE(f, a) +#endif #ifndef NULL #define NULL 0 @@ -336,6 +358,10 @@ static INLINE GLuint CPU_TO_LE32(GLuint x) #define M_E (2.7182818284590452354) #endif +#ifndef M_LOG2E +#define M_LOG2E (1.4426950408889634074) +#endif + #ifndef ONE_DIV_LN2 #define ONE_DIV_LN2 (1.442695040888963456) #endif