check for builtin_expect and define GCC_UNLIKELY
Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2188
This commit is contained in:
parent
6157cbaebf
commit
4a2808a9a6
3 changed files with 18 additions and 0 deletions
|
@ -331,6 +331,12 @@ AH_BOTTOM([#if C_HAS_ATTRIBUTE
|
|||
#define GCC_ATTRIBUTE(x) /* attribute not supported */
|
||||
#endif])
|
||||
|
||||
AH_BOTTOM([#if C_HAS_BUILTIN_EXPECT
|
||||
#define GCC_UNLIKELY(x) __builtin_expect((x),0)
|
||||
#else
|
||||
#define GCC_UNLIKELY(x) (x)
|
||||
#endif])
|
||||
|
||||
AH_BOTTOM([
|
||||
typedef double Real64;
|
||||
|
||||
|
|
11
configure.in
11
configure.in
|
@ -58,6 +58,17 @@ AC_MSG_CHECKING(if compiler allows __attribute__)
|
|||
AC_TRY_COMPILE([], [typedef struct { } __attribute__ ((packed)) junk;],
|
||||
[ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_ATTRIBUTE)],AC_MSG_RESULT(no))
|
||||
|
||||
#Check if the compiler supports __builtin_expect
|
||||
AH_TEMPLATE([C_HAS_BUILTIN_EXPECT],[Determines if the compilers supports __builtin_expect for branch prediction.])
|
||||
AC_MSG_CHECKING(if compiler allows __builtin_expect)
|
||||
AC_TRY_COMPILE([],[
|
||||
int main(int argc,char* argv[]){
|
||||
int x=10;if( __builtin_expect ((x==1),0) ) ;
|
||||
return 0;
|
||||
}
|
||||
], [ AC_MSG_RESULT(yes);AC_DEFINE(C_HAS_BUILTIN_EXPECT)],AC_MSG_RESULT(no))
|
||||
|
||||
|
||||
AM_PATH_ALSA(0.9.0, AC_DEFINE(HAVE_ALSA,1,[Define to 1 to use ALSA for MIDI]) , : )
|
||||
|
||||
#Check for big endian machine, should #define WORD_BIGENDIAN if so
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#define C_DIRECTSERIAL 1
|
||||
|
||||
#define GCC_ATTRIBUTE(x) /* attribute not supported */
|
||||
#define GCC_UNLIKELY(x) (x)
|
||||
|
||||
typedef double Real64;
|
||||
/* The internal types */
|
||||
|
|
Loading…
Add table
Reference in a new issue