Merge with develop

--HG--
branch : compatibility-develop
hg/compatibility-develop
kervala 9 years ago
commit e91c529a98

@ -39,7 +39,7 @@
#endif #endif
#if defined(NL_CPU_INTEL) && defined(NL_COMP_GCC) #if defined(NL_CPU_INTEL) && defined(NL_COMP_GCC)
#include "x86intrin.h" #include <x86intrin.h>
#endif #endif
#include "string_common.h" #include "string_common.h"
@ -69,8 +69,20 @@ namespace NLMISC
inline uint64 rdtsc() inline uint64 rdtsc()
{ {
// __rdtsc() is defined under all platforms #if defined(NL_COMP_GCC) && !defined(CLANG_VERSION) && (GCC_VERSION <= 40405)
// for GCC versions that don't implement __rdtsc()
#ifdef NL_CPU_X86_64
uint64 low, high;
__asm__ volatile("rdtsc" : "=a" (low), "=d" (high));
return low | (high << 32);
#else
uint64 ticks;
__asm__ volatile("rdtsc" : "=A" (ticks));
return ticks;
#endif
#else
return uint64(__rdtsc()); return uint64(__rdtsc());
#endif
} }
#endif // NL_CPU_INTEL #endif // NL_CPU_INTEL

@ -191,6 +191,10 @@
# define NL_ISO_STDTR1_HEADER(header) <header> # define NL_ISO_STDTR1_HEADER(header) <header>
# define NL_ISO_STDTR1_NAMESPACE std # define NL_ISO_STDTR1_NAMESPACE std
# endif # endif
# endif
// clang define GCC version for compatibility
# ifdef __clang__
# define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100 + __clang_patchlevel__)
# endif # endif
#endif #endif

Loading…
Cancel
Save