mirror of
https://github.com/isar/libmdbx.git
synced 2025-01-04 17:14:12 +08:00
mdbx: add neutral __ia32__ and __amd64__ marcos.
This commit is contained in:
parent
a282965aa0
commit
62ae928b40
25
src/osal.h
25
src/osal.h
@ -117,11 +117,28 @@ typedef pthread_mutex_t mdbx_fastmutex_t;
|
|||||||
#include <sys/file.h>
|
#include <sys/file.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined(i386) || defined(__386) || defined(__i386) || defined(__i386__) || \
|
||||||
|
defined(i486) || defined(__i486) || defined(__i486__) || \
|
||||||
|
defined(i586) | defined(__i586) || defined(__i586__) || defined(i686) || \
|
||||||
|
defined(__i686) || defined(__i686__) || defined(_M_IX86) || \
|
||||||
|
defined(_X86_) || defined(__THW_INTEL__) || defined(__I86__) || \
|
||||||
|
defined(__INTEL__) || defined(__x86_64) || defined(__x86_64__) || \
|
||||||
|
defined(__amd64__) || defined(__amd64) || defined(_M_X64) || \
|
||||||
|
defined(_M_AMD64) || defined(__IA32__) || defined(__INTEL__)
|
||||||
|
#ifndef __ia32__
|
||||||
|
/* LY: define neutral __ia32__ for x86 and x86-64 archs */
|
||||||
|
#define __ia32__ 1
|
||||||
|
#endif /* __ia32__ */
|
||||||
|
#if !defined(__amd64__) && (defined(__x86_64) || defined(__x86_64__) || \
|
||||||
|
defined(__amd64) || defined(_M_X64))
|
||||||
|
/* LY: define trusty __amd64__ for all AMD64/x86-64 arch */
|
||||||
|
#define __amd64__ 1
|
||||||
|
#endif /* __amd64__ */
|
||||||
|
#endif /* all x86 */
|
||||||
|
|
||||||
#if !defined(UNALIGNED_OK)
|
#if !defined(UNALIGNED_OK)
|
||||||
#if (defined(__i386) || defined(__x86_64__) || defined(_M_IX86) || \
|
#if (defined(__ia32__) || defined(__e2k__) || \
|
||||||
defined(_M_X64) || defined(i386) || defined(_X86_) || \
|
defined(__ARM_FEATURE_UNALIGNED)) && \
|
||||||
defined(__i386__) || defined(_X86_64_) || \
|
|
||||||
defined(__ARM_FEATURE_UNALIGNED) || defined(__e2k__)) && \
|
|
||||||
!defined(__ALIGNED__)
|
!defined(__ALIGNED__)
|
||||||
#define UNALIGNED_OK 1
|
#define UNALIGNED_OK 1
|
||||||
#else
|
#else
|
||||||
|
@ -127,6 +127,7 @@ bool hex2data(const char *hex_begin, const char *hex_end, void *ptr,
|
|||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/* TODO: replace my 'libmera' fomr t1ha. */
|
||||||
uint64_t entropy_ticks(void) {
|
uint64_t entropy_ticks(void) {
|
||||||
#if defined(__GNUC__) || defined(__clang__)
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
#if defined(__ia64__)
|
#if defined(__ia64__)
|
||||||
@ -165,8 +166,7 @@ uint64_t entropy_ticks(void) {
|
|||||||
#endif /* arch selector */
|
#endif /* arch selector */
|
||||||
#endif /* __GNUC__ || __clang__ */
|
#endif /* __GNUC__ || __clang__ */
|
||||||
|
|
||||||
#if defined(__e2k__) || defined(__elbrus__) || defined(_M_IX86) || \
|
#if defined(__e2k__) || defined(__ia32__)
|
||||||
defined(_M_X64) || defined(__x86_64__) || defined(__i386__)
|
|
||||||
return __rdtsc();
|
return __rdtsc();
|
||||||
#elif defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS)
|
#elif defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS)
|
||||||
LARGE_INTEGER PerformanceCount;
|
LARGE_INTEGER PerformanceCount;
|
||||||
|
@ -274,7 +274,7 @@ static __inline void memory_barrier(void) {
|
|||||||
#elif defined(__INTEL_COMPILER) /* LY: Intel Compiler may mimic GCC and MSC */
|
#elif defined(__INTEL_COMPILER) /* LY: Intel Compiler may mimic GCC and MSC */
|
||||||
#if defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
|
#if defined(__ia64__) || defined(__ia64) || defined(_M_IA64)
|
||||||
__mf();
|
__mf();
|
||||||
#elif defined(__i386__) || defined(__x86_64__)
|
#elif defined(__ia32__)
|
||||||
_mm_mfence();
|
_mm_mfence();
|
||||||
#else
|
#else
|
||||||
#error "Unknown target for Intel Compiler, please report to us."
|
#error "Unknown target for Intel Compiler, please report to us."
|
||||||
@ -293,8 +293,7 @@ static __inline void memory_barrier(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static __inline void cpu_relax() {
|
static __inline void cpu_relax() {
|
||||||
#if defined(__i386__) || defined(__x86_64__) || defined(_M_IX86) || \
|
#if defined(__ia32__)
|
||||||
defined(_M_X64)
|
|
||||||
_mm_pause();
|
_mm_pause();
|
||||||
#elif defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS) || \
|
#elif defined(_WIN32) || defined(_WIN64) || defined(_WINDOWS) || \
|
||||||
defined(YieldProcessor)
|
defined(YieldProcessor)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user